[gen] Zope patch.
This commit is contained in:
parent
826664b798
commit
58f3dc5c0c
|
@ -16,12 +16,23 @@ from appy.shared.data import languages
|
||||||
homePage = '<tal:h define="dummy python: request.RESPONSE.redirect(' \
|
homePage = '<tal:h define="dummy python: request.RESPONSE.redirect(' \
|
||||||
'context.config.getHomePage())"/>'
|
'context.config.getHomePage())"/>'
|
||||||
|
|
||||||
# Cheat for disabling Zope's XMLRPC --------------------------------------------
|
# Zope hacks -------------------------------------------------------------------
|
||||||
class FakeXmlrpc:
|
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 parse_input(self, value): return None, ()
|
||||||
def response(self, response): return response
|
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):
|
def onDelSession(sessionObject, container):
|
||||||
'''This function is called when a session expires.'''
|
'''This function is called when a session expires.'''
|
||||||
rq = container.REQUEST
|
rq = container.REQUEST
|
||||||
|
@ -312,11 +323,15 @@ class ZopeInstaller:
|
||||||
self.app.__ac_roles__ = tuple(roles)
|
self.app.__ac_roles__ = tuple(roles)
|
||||||
|
|
||||||
def patchZope(self):
|
def patchZope(self):
|
||||||
'''Patches some arts of Zope.'''
|
'''Patches some arts of Zope'''
|
||||||
# Disables XMLRPC. This way, Zope can transmit HTTP POSTs containing
|
# Disable XMLRPC. This way, Zope can transmit HTTP POSTs containing
|
||||||
# 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
|
||||||
|
|
Loading…
Reference in a new issue