[Zope-Checkins] CVS: Zope2 - content_types.py:1.15

andreas@serenade.digicool.com andreas@serenade.digicool.com
Thu, 31 May 2001 08:48:59 -0400


Update of /cvs-repository/Zope2/lib/python/OFS
In directory serenade:/tmp/cvs-serv24546

Modified Files:
	content_types.py 
Log Message:
added support to detect XML files and set content-type to text/xml
(Collector #2248)



--- Updated File content_types.py in package Zope2 --
--- content_types.py	2001/04/27 18:07:13	1.14
+++ content_types.py	2001/05/31 12:48:58	1.15
@@ -95,7 +95,12 @@
     # Yuk. See if we can figure out the type by content.
     if (lower(strip(s)[:6]) == '<html>' or find(s, '</') > 0):
         return 'text/html'
-    return 'text/plain'
+
+    elif s.strip().startswith('<?xml'):
+        return 'text/xml'
+
+    else:
+        return 'text/plain'