Sorry I went quiet on this - I got a bit tied up with other stuff. I've installed the latest version of webob, from github, and it doesn't fix either problem. I've also been playing with a local copy.
I've worked out a fix for the case sensitive matching of MIME types - simply adding .lower() at the appropriate places in MIMEAccept._match (similar to what Accept._match does) The whole selection of the best match by q-value seems to be subverted by the calling environment. As far as I can tell the logic within Accept.best_match is working just fine, but for a single HTTP request, I'm seeing the Accept object constructed 4 times, and best_match called three times, with different "offer" lists. As far as I can tell, the final instantiation of Accept doesn't call best_match at all, and that's what's returned to the caller: **** Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/ *;q=0.8,application/rdf+xml;q=0.93,text/rdf+n3;q=0.5 **** best_match ['application/rdf+xml', 'text/turtle', 'text/html'] : **** Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/ *;q=0.8,application/rdf+xml;q=0.93,text/rdf+n3;q=0.5 **** best_match ['application/rdf+xml', 'text/turtle'] : **** Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/ *;q=0.8,application/rdf+xml;q=0.93,text/rdf+n3;q=0.5 **** best_match ['text/turtle'] **** Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/ *;q=0.8,application/rdf+xml;q=0.93,text/rdf+n3;q=0.5 So it seems that the Pyramid request routing logic is making multiple calls with a reducing list of possible server offers for handling the MIME type. #g On May 14, 3:18 pm, Graham Higgins <[email protected]> wrote: > On Fri, 2012-05-11 at 14:03 -0700, Graham Klyne wrote: > > If using decorators to configure the views, how is "batting order" > > defined. It seems to me that it;'s somewhat at the whim of the Python > > compiler? > > Sorry for the nonsense - I should have spent more time investigating. > > > > > (c) The matching doesn't honour the q= values generated by browsers; > > It transpired that WebOb was improperly rounding float q values to a > single decimal via a "%0.1f". That is now fixed in the latest WebOb > repos: > > https://github.com/Pylons/webob > > -- > Graham Higgins > > http://bel-epa.com/gjh/ > > signature.asc > < 1KViewDownload -- You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
