Log message for revision 68028:
  bring back some junk that's apparently needed
  

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

-=-
Modified: 
Zope/branches/ajung-zpt-end-game/lib/python/Products/PageTemplates/PageTemplateFile.py
===================================================================
--- 
Zope/branches/ajung-zpt-end-game/lib/python/Products/PageTemplates/PageTemplateFile.py
      2006-05-08 17:49:44 UTC (rev 68027)
+++ 
Zope/branches/ajung-zpt-end-game/lib/python/Products/PageTemplates/PageTemplateFile.py
      2006-05-08 18:08:41 UTC (rev 68028)
@@ -208,3 +208,20 @@
                              "cannot be stored." % self.__class__.__name__)
 
 InitializeClass(PageTemplateFile)
+
+XML_PREFIXES = [
+    "<?xml",                      # ascii, utf-8
+    "\xef\xbb\xbf<?xml",          # utf-8 w/ byte order mark
+    "\0<\0?\0x\0m\0l",            # utf-16 big endian
+    "<\0?\0x\0m\0l\0",            # utf-16 little endian
+    "\xfe\xff\0<\0?\0x\0m\0l",    # utf-16 big endian w/ byte order mark
+    "\xff\xfe<\0?\0x\0m\0l\0",    # utf-16 little endian w/ byte order mark
+    ]
+
+XML_PREFIX_MAX_LENGTH = max(map(len, XML_PREFIXES))
+
+def sniff_type(text):
+    for prefix in XML_PREFIXES:
+        if text.startswith(prefix):
+            return "text/xml"
+    return None

_______________________________________________
Zope-Checkins maillist  -  Zope-Checkins@zope.org
http://mail.zope.org/mailman/listinfo/zope-checkins

Reply via email to