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

Jens Vagelpohl jens at dataflake.org
Mon Mar 7 06:27:04 EST 2005


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

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



=== Products/CMFCore/FSPageTemplate.py 1.26.2.2 => 1.26.2.3 ===
--- Products/CMFCore/FSPageTemplate.py:1.26.2.2	Thu Oct  7 07:52:16 2004
+++ Products/CMFCore/FSPageTemplate.py	Mon Mar  7 06:26:33 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