Commit 59b8e7c8 authored by Yoshinori Okuji's avatar Yoshinori Okuji

Adapt to the latest CMFReportTool.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@17069 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent d9250d8b
...@@ -212,7 +212,15 @@ except ImportError: ...@@ -212,7 +212,15 @@ except ImportError:
HAS_ZODB_RESOURCE_HANDLER=0 HAS_ZODB_RESOURCE_HANDLER=0
from Products.CMFReportTool.RenderPDF.Parser import TemplateParser,DocumentParser 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 from StringIO import StringIO
import xml.dom.minidom import xml.dom.minidom
import urllib,os.path import urllib,os.path
...@@ -225,7 +233,13 @@ if HAS_ZODB_RESOURCE_HANDLER: ...@@ -225,7 +233,13 @@ if HAS_ZODB_RESOURCE_HANDLER:
def handleZODB(self,path): def handleZODB(self,path):
path = path.split('/') path = path.split('/')
if boboAwareZopeTraverse is None:
obj = restrictedTraverse(self.context,path,getSecurityManager()) 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 ... # check type and e.g. call object if script ...
if callable(obj): if callable(obj):
...@@ -256,7 +270,12 @@ else: ...@@ -256,7 +270,12 @@ else:
def zodb_open(self, req): def zodb_open(self, req):
path = req.get_selector() path = req.get_selector()
path = path.split('/') path = path.split('/')
if boboAwareZopeTraverse is None:
obj = restrictedTraverse(self.context,path,getSecurityManager()) 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 ... # check type and e.g. call object if script ...
if callable(obj): if callable(obj):
......
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