Commit 93f40b14 authored by Hanno Schlichting's avatar Hanno Schlichting

Prevent ZopeTestCase to load any ZCML as a side-effect of calling Zope2.app()....

Prevent ZopeTestCase to load any ZCML as a side-effect of calling Zope2.app(). Loading ZCML has to be deferred to layer setup time.
parent e1ada011
......@@ -129,6 +129,11 @@ def _apply_patches():
def null_register_help(self,directory='',clear=1,title_re=None): pass
App.ProductContext.ProductContext.registerHelp = null_register_help
# Avoid loading any ZCML
from Zope2.App import startup as zopeapp_startup
def null_load_zcml(): pass
zopeapp_startup.load_zcml = null_load_zcml
# Note that we applied the monkey patches
global _patched
_patched = True
......
......@@ -46,6 +46,16 @@ app = None
startup_time = asctime()
def load_zcml():
# This hook is overriden by ZopeTestCase
from .zcml import load_site
load_site()
# Set up Zope2 specific vocabulary registry
from .schema import configure_vocabulary_registry
configure_vocabulary_registry()
def startup():
from App.PersistentExtra import patchPersistent
import Globals # to set / fetch data
......@@ -105,12 +115,7 @@ def startup():
newSecurityManager(None, AccessControl.User.system)
# Set up the CA
from .zcml import load_site
load_site()
# Set up Zope2 specific vocabulary registry
from .schema import configure_vocabulary_registry
configure_vocabulary_registry()
load_zcml()
# Set up the "app" object that automagically opens
# connections
......
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