[Zope-CMF] More content type madness
Jens Vagelpohl
jens at dataflake.org
Wed Sep 8 11:00:15 EDT 2004
Hi guys,
are there any objections to patching FSPageTemplate.py so that I can
force a content type by declaring it inside a .metadata file, like I
now can for FSFiles? I just posted this issue:
http://zope.org/Collectors/CMF/284
jens
P.S.: And, since that &%$# collector makes it hard to look at uploaded
patches by giving them content type application/octet-stream, here's
the patch again:
Index: CMFCore/FSPageTemplate.py
===================================================================
RCS file: /cvs-repository/Products/CMFCore/FSPageTemplate.py,v
retrieving revision 1.26.2.1
diff -u -r1.26.2.1 FSPageTemplate.py
--- CMFCore/FSPageTemplate.py 3 Sep 2004 18:01:10 -0000 1.26.2.1
+++ CMFCore/FSPageTemplate.py 8 Sep 2004 14:51:30 -0000
@@ -65,6 +65,10 @@
def __init__(self, id, filepath, fullname=None, properties=None):
FSObject.__init__(self, id, filepath, fullname, properties)
self.ZBindings_edit(self._default_bindings)
+ self._metadata_ctype = None
+
+ if properties is not None:
+ self._metadata_ctype = properties.get('content_type', None)
def _createZODBClone(self):
"""Create a ZODB (editable) equivalent of this object."""
@@ -89,7 +93,11 @@
# 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 self._metadata_ctype is None:
+ self.content_type = 'text/xml; charset=%s' %
encoding
+ else:
+ self.content_type = self._metadata_ctype
self.write(data)
More information about the Zope-CMF
mailing list