From 92622d46f1b90db41f77b97f670d2d4d9fbcdd95 Mon Sep 17 00:00:00 2001 From: Nicolas Delaby <nicolas@nexedi.com> Date: Fri, 28 Jan 2011 15:11:15 +0000 Subject: [PATCH] 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 --- product/ERP5OOo/OOoTemplate.py | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/product/ERP5OOo/OOoTemplate.py b/product/ERP5OOo/OOoTemplate.py index 9effc4d9e6..b50415c18a 100644 --- a/product/ERP5OOo/OOoTemplate.py +++ b/product/ERP5OOo/OOoTemplate.py @@ -258,13 +258,19 @@ class OOoTemplate(ZopePageTemplate): file = builder.prepareContentXml(self.ooo_xml_file_id) return ZopePageTemplate.pt_upload(self, REQUEST, file) - 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) + if 'pt_edit' not in ZopePageTemplate.__dict__: + # Override it only for 2.8 ! + # ZopePageTemplate v.2.8 inherate pt_edit from + # PageTemplate. If method is defined on ZopePageTemplate + # means we are under 2.12. + # Delete me when we drop support of 2.8 + 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') def doSettings(self, REQUEST, title, xml_file_id, ooo_stylesheet, script_name=None): -- 2.30.9