Commit 92622d46 authored by Nicolas Delaby's avatar Nicolas Delaby

Stop overriding pt_edit for Zope version greater that 2.8 as ZopePageTemplate.pt_edit

is bug free and does more pretty things like calling ZCacheable_invalidate.



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@42747 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent eea04e7b
...@@ -258,13 +258,19 @@ class OOoTemplate(ZopePageTemplate): ...@@ -258,13 +258,19 @@ class OOoTemplate(ZopePageTemplate):
file = builder.prepareContentXml(self.ooo_xml_file_id) file = builder.prepareContentXml(self.ooo_xml_file_id)
return ZopePageTemplate.pt_upload(self, REQUEST, file) return ZopePageTemplate.pt_upload(self, REQUEST, file)
security.declareProtected('Change Page Templates', 'pt_edit') if 'pt_edit' not in ZopePageTemplate.__dict__:
def pt_edit(self, text, content_type): # Override it only for 2.8 !
if content_type: # ZopePageTemplate v.2.8 inherate pt_edit from
self.content_type = str(content_type) # PageTemplate. If method is defined on ZopePageTemplate
if hasattr(text, 'read'): # means we are under 2.12.
text = text.read() # Delete me when we drop support of 2.8
self.write(text) security.declareProtected('Change Page Templates', 'pt_edit')
def pt_edit(self, text, content_type):
if content_type:
self.content_type = str(content_type)
if hasattr(text, 'read'):
text = text.read()
self.write(text)
security.declareProtected('Change Page Templates', 'doSettings') security.declareProtected('Change Page Templates', 'doSettings')
def doSettings(self, REQUEST, title, xml_file_id, ooo_stylesheet, script_name=None): def doSettings(self, REQUEST, title, xml_file_id, ooo_stylesheet, script_name=None):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment