# HG changeset patch # User Sylvain Thénault # Date 1265448687 -3600 # Node ID d87989d91635778f5820de15f3adc82020ebb068 # Parent 297a63704761753b1a4e80787ef886d5904dbacb fix duplicated vregistry initialization during tests diff -r 297a63704761 -r d87989d91635 web/application.py --- a/web/application.py Thu Feb 04 18:29:43 2010 +0100 +++ b/web/application.py Sat Feb 06 10:31:27 2010 +0100 @@ -226,17 +226,23 @@ def __init__(self, config, debug=None, session_handler_fact=CookieSessionHandler, vreg=None): - super(CubicWebPublisher, self).__init__() - # connect to the repository and get instance's schema + self.info('starting web instance from %s', config.apphome) if vreg is None: vreg = cwvreg.CubicWebVRegistry(config, debug=debug) + need_set_schema = True + else: + # vreg is specified during test and the vreg is already properly + # initialized. Even, reinitializing it may cause some unwanted + # side effect due to unproper reloading of appobjects modules + need_set_schema = False self.vreg = vreg - self.info('starting web instance from %s', config.apphome) + # connect to the repository and get instance's schema self.repo = config.repository(vreg) if not vreg.initialized: self.config.init_cubes(self.repo.get_cubes()) vreg.init_properties(self.repo.properties()) - vreg.set_schema(self.repo.get_schema()) + if need_set_schema: + vreg.set_schema(self.repo.get_schema()) # set the correct publish method if config['query-log-file']: from threading import Lock