[CMF-checkins] CVS: Products/CMFCore - FSPageTemplate.py:1.29

Jens Vagelpohl jens at dataflake.org
Mon Mar 7 06:22:38 EST 2005


Update of /cvs-repository/Products/CMFCore
In directory cvs.zope.org:/tmp/cvs-serv7808/CMFCore

Modified Files:
	FSPageTemplate.py 
Log Message:
- FSPageTemplate: Ensure that if a content type is specified using a
  .metadata file we respect it (http://www.zope.org/Collectors/CMF/320)


=== Products/CMFCore/FSPageTemplate.py 1.28 => 1.29 ===
--- Products/CMFCore/FSPageTemplate.py:1.28	Thu Oct  7 08:01:02 2004
+++ Products/CMFCore/FSPageTemplate.py	Mon Mar  7 06:22:07 2005
@@ -83,13 +83,17 @@
             data = file.read()
         finally:
             file.close()
+
         if reparse:
-            xml_info = xml_detect_re.match(data)
-            if xml_info:
-                # Smells like xml
-                # set "content_type" from the XML declaration
-                encoding = xml_info.group(1) or 'utf-8'
-                self.content_type = 'text/xml; charset=%s' % encoding
+            # If we already have a content_type set it must come from a
+            # .metadata file and we should always honor that
+            if getattr(self, 'content_type', None) is not None:
+                xml_info = xml_detect_re.match(data)
+                if xml_info:
+                    # Smells like xml
+                    # set "content_type" from the XML declaration
+                    encoding = xml_info.group(1) or 'utf-8'
+                    self.content_type = 'text/xml; charset=%s' % encoding
 
             self.write(data)
 



More information about the CMF-checkins mailing list