[Zope-Checkins] SVN: Zope/branches/ajung-zpt-encoding-fixes/lib/python/Products/PageTemplates/PageTemplateFile.py added workaround where guess_content_type() did not detect text/xml properly

Andreas Jung andreas at andreas-jung.com
Sun Dec 17 13:39:51 EST 2006


Log message for revision 71567:
  added workaround where guess_content_type() did not detect text/xml properly
  (should be fixed in Zope 3)
  

Changed:
  U   Zope/branches/ajung-zpt-encoding-fixes/lib/python/Products/PageTemplates/PageTemplateFile.py

-=-
Modified: Zope/branches/ajung-zpt-encoding-fixes/lib/python/Products/PageTemplates/PageTemplateFile.py
===================================================================
--- Zope/branches/ajung-zpt-encoding-fixes/lib/python/Products/PageTemplates/PageTemplateFile.py	2006-12-17 18:08:25 UTC (rev 71566)
+++ Zope/branches/ajung-zpt-encoding-fixes/lib/python/Products/PageTemplates/PageTemplateFile.py	2006-12-17 18:39:50 UTC (rev 71567)
@@ -32,6 +32,13 @@
 LOG = getLogger('PageTemplateFile')
 
 def guess_type(filename, text):
+
+    # check for XML ourself since guess_content_type can't
+    # detect text/xml  if 'filename' won't end with .xml
+
+    if text.startswith('<?xml'):
+        return 'text/xml'
+
     content_type, dummy = guess_content_type(filename, text)
     if content_type in ('text/html', 'text/xml'):
         return content_type



More information about the Zope-Checkins mailing list