[Zope-dev] Bug in zc.resourcelibrary?

Thomas Lotze thomas at thomas-lotze.de
Tue Dec 4 08:54:38 EST 2007


I found some behaviour of zc.resourcelib which I'm not sure is intended
that way: The lib takes care to apply only to HTML and XML content, so it
tests whether the content type (if set) is among text/html and text/xml:

  if content_type == 'text/html' or content_type == 'text/xml':
      ...

However, it does so by exact comparison, so it would apply to "text/html"
but not "text/html; charset=utf-8".  Wouldn't a check like

  if content_type.split(';', 1)[0] in ('text/html', 'text/xml'):
      ...

be more appropriate?

-- 
Thomas





More information about the Zope-Dev mailing list