[gen] Bugfix.

This commit is contained in:
Gaetan Delannay 2015-03-11 21:38:09 +01:00
parent 58f3dc5c0c
commit 934ca360cc

View file

@ -24,14 +24,21 @@ class FakeXmlrpc:
def response(self, response): return response def response(self, response): return response
class FakeZCatalog: class FakeZCatalog:
# This prevents Zope frop crashing when, while updating the catalog, an
# entry in the catalog corresponds to a missing object.
def resolve_url(self, path, REQUEST): def resolve_url(self, path, REQUEST):
'''Cheat: "hasattr" test has been added in first line.''' '''Cheat: "hasattr" test has been added in first line'''
if REQUEST and hasattr(REQUEST, 'script'): if REQUEST and hasattr(REQUEST, 'script'):
script=REQUEST.script script=REQUEST.script
if path.find(script) != 0: if path.find(script) != 0:
path='%s/%s' % (script, path) path='%s/%s' % (script, path)
try: return REQUEST.resolve_url(path) try: return REQUEST.resolve_url(path)
except: pass except: pass
try:
from Products.ZCatalog.ZCatalog import ZCatalog
ZCatalog.resolve_url = resolve_url
except ImportError:
pass
def onDelSession(sessionObject, container): def onDelSession(sessionObject, container):
'''This function is called when a session expires.''' '''This function is called when a session expires.'''
@ -328,10 +335,6 @@ class ZopeInstaller:
# XML to Appy without trying to recognize it himself as XMLRPC requests. # XML to Appy without trying to recognize it himself as XMLRPC requests.
import ZPublisher.HTTPRequest import ZPublisher.HTTPRequest
ZPublisher.HTTPRequest.xmlrpc = FakeXmlrpc() ZPublisher.HTTPRequest.xmlrpc = FakeXmlrpc()
# This prevents Zope frop crashing when, while updating the catalog, an
# entry in the catalog corresponds to a missing object.
from Products.ZCatalog.ZCatalog import ZCatalog
ZCatalog.resolve_url = FakeZCatalog.resolve_url
def installDependencies(self): def installDependencies(self):
'''Zope products are installed in alphabetical order. But here, we need '''Zope products are installed in alphabetical order. But here, we need