[gen] Zope patch.

This commit is contained in:
Gaetan Delannay 2015-03-11 21:29:58 +01:00
parent 826664b798
commit 58f3dc5c0c

View file

@ -16,12 +16,23 @@ from appy.shared.data import languages
homePage = '<tal:h define="dummy python: request.RESPONSE.redirect(' \
'context.config.getHomePage())"/>'
# Cheat for disabling Zope's XMLRPC --------------------------------------------
# Zope hacks -------------------------------------------------------------------
class FakeXmlrpc:
'''Fake class that behaves like Zope's xmlrpc module.'''
'''Fake class that behaves like Zope's xmlrpc module. This cheat disables
Zope's XMLRPC.'''
def parse_input(self, value): return None, ()
def response(self, response): return response
class FakeZCatalog:
def resolve_url(self, path, REQUEST):
'''Cheat: "hasattr" test has been added in first line.'''
if REQUEST and hasattr(REQUEST, 'script'):
script=REQUEST.script
if path.find(script) != 0:
path='%s/%s' % (script, path)
try: return REQUEST.resolve_url(path)
except: pass
def onDelSession(sessionObject, container):
'''This function is called when a session expires.'''
rq = container.REQUEST
@ -312,11 +323,15 @@ class ZopeInstaller:
self.app.__ac_roles__ = tuple(roles)
def patchZope(self):
'''Patches some arts of Zope.'''
# Disables XMLRPC. This way, Zope can transmit HTTP POSTs containing
'''Patches some arts of Zope'''
# Disable XMLRPC. This way, Zope can transmit HTTP POSTs containing
# XML to Appy without trying to recognize it himself as XMLRPC requests.
import ZPublisher.HTTPRequest
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):
'''Zope products are installed in alphabetical order. But here, we need