webograph
webograph at eml.cc
Fri Aug 18 20:06:13 EDT 2006
hi deron, from my understanding, this mod_python would be the preferrable place to put such functions (even better, mod_python could use apache functionality for this, but i don't know enough about the interaction btwn apache and mod_python to say whether this is feasible or not) > * Is this something that seems useful to others? absolutely yes! could you post it? regards webograph On Thu, 02 Feb 2006 22:30:52 GMT, Deron Meranda wrote: > Essentially I have functions that: > > 1. Parse and sort any Accept-* header according to the RFC's BNF > 2. Negotiate the best content type > 3. Negotiate the best language > 4. Negotiate the best encoding > 5. Negotiate the best charset > > It also knows how to handle wildcards, hierarchical language tags, > charset name aliases, etc. And you can tell it to ignore the "super" > wildcards like */* too. > > As a quick example you can do something like > > acc = req.headers_in['Accept'] > ct = acceptable_content_type( acc, ['text/html','application/xhtml+xml'] ) > > and it will tell you which of the two formats the browser supports/prefers, > if either, according to all the complex rules in the RFC. > > I have some preliminary questions: > > * Is this something that seems useful to others? > * Is mod_python util a preferable place to consider putting these, > or maybe this should perhaps go to something larger like > WSGI or some other Web-SIG project? (sorry for faking this reply -- i found the original mail in the http archive)
|