diff --git a/product/ERP5Form/PDFTemplate.py b/product/ERP5Form/PDFTemplate.py index 0a14cdb7a7825984d0d6dc4d4f82e35efe376cb8..7a6ff1170ae21573ca1c80f17ae9eac5c52e6925 100644 --- a/product/ERP5Form/PDFTemplate.py +++ b/product/ERP5Form/PDFTemplate.py @@ -212,7 +212,15 @@ except ImportError: HAS_ZODB_RESOURCE_HANDLER=0 from Products.CMFReportTool.RenderPDF.Parser import TemplateParser,DocumentParser -from Products.PageTemplates.Expressions import restrictedTraverse + +try: + # Zope 2.10 and later. + from Products.PageTemplates.Expressions import boboAwareZopeTraverse +except ImportError: + # Zope 2.9 and earlier. + boboAwareZopeTraverse = None + from Products.PageTemplates.Expressions import restrictedTraverse + from StringIO import StringIO import xml.dom.minidom import urllib,os.path @@ -225,7 +233,13 @@ if HAS_ZODB_RESOURCE_HANDLER: def handleZODB(self,path): path = path.split('/') - obj = restrictedTraverse(self.context,path,getSecurityManager()) + if boboAwareZopeTraverse is None: + obj = restrictedTraverse(self.context,path,getSecurityManager()) + else: + # XXX only the request should be required, but this looks ad-hoc.. + econtext = dict(request=self.context.REQUEST) + obj = boboAwareZopeTraverse(self.context, path, econtext) + # check type and e.g. call object if script ... if callable(obj): @@ -256,7 +270,12 @@ else: def zodb_open(self, req): path = req.get_selector() path = path.split('/') - obj = restrictedTraverse(self.context,path,getSecurityManager()) + if boboAwareZopeTraverse is None: + obj = restrictedTraverse(self.context,path,getSecurityManager()) + else: + # XXX only the request should be required, but this looks ad-hoc.. + econtext = dict(request=self.context.REQUEST) + obj = boboAwareZopeTraverse(self.context, path, econtext) # check type and e.g. call object if script ... if callable(obj):