remove vreg argument to CWPublisher
authorPierre-Yves David <pierre-yves.david@logilab.fr>
Fri, 07 Dec 2012 17:23:04 +0100
changeset 9030 c1d5e8ca15ea
parent 9029 5941cde49878
child 9031 6ff29f2879da
remove vreg argument to CWPublisher The passing a vreg to CWPublisher was used by test to allow reused of an existing vreg. We dropped this feature two commit ago and can safely removes it. Removing this argument allows later cleanup and improvement on the CWPublisher and Repository front. closes #2944813
devtools/httptest.py
devtools/testlib.py
etwist/server.py
web/application.py
wsgi/handler.py
--- a/devtools/httptest.py	Fri Dec 07 16:10:38 2012 +0100
+++ b/devtools/httptest.py	Fri Dec 07 17:23:04 2012 +0100
@@ -101,7 +101,7 @@
 
         reactor.addSystemEventTrigger('after', 'startup', semaphore.release)
         t = threading.Thread(target=safe_run, name='cubicweb_test_web_server',
-                             args=(self.config, self.vreg, True))
+                             args=(self.config, True))
         self.web_thread = t
         t.start()
         semaphore.acquire()
--- a/devtools/testlib.py	Fri Dec 07 16:10:38 2012 +0100
+++ b/devtools/testlib.py	Fri Dec 07 17:23:04 2012 +0100
@@ -633,7 +633,7 @@
     @cached
     def app(self):
         """return a cubicweb publisher"""
-        publisher = application.CubicWebPublisher(self.config, vreg=self.vreg)
+        publisher = application.CubicWebPublisher(self.config)
         def raise_error_handler(*args, **kwargs):
             raise
         publisher.error_handler = raise_error_handler
--- a/etwist/server.py	Fri Dec 07 16:10:38 2012 +0100
+++ b/etwist/server.py	Fri Dec 07 17:23:04 2012 +0100
@@ -57,12 +57,12 @@
 
 
 class CubicWebRootResource(resource.Resource):
-    def __init__(self, config, vreg=None):
+    def __init__(self, config):
         resource.Resource.__init__(self)
         self.config = config
         # instantiate publisher here and not in init_publisher to get some
         # checks done before daemonization (eg versions consistency)
-        self.appli = CubicWebPublisher(config, vreg=vreg)
+        self.appli = CubicWebPublisher(config)
         self.base_url = config['base-url']
         self.https_url = config['https-url']
         global MAX_POST_LENGTH
@@ -270,12 +270,12 @@
 LOGGER = getLogger('cubicweb.twisted')
 set_log_methods(CubicWebRootResource, LOGGER)
 
-def run(config, vreg=None, debug=None):
+def run(config, debug=None):
     if debug is not None:
         config.debugmode = debug
     config.check_writeable_uid_directory(config.appdatahome)
     # create the site
-    root_resource = CubicWebRootResource(config, vreg=vreg)
+    root_resource = CubicWebRootResource(config)
     website = server.Site(root_resource)
     # serve it via standard HTTP on port set in the configuration
     port = config['port'] or 8080
--- a/web/application.py	Fri Dec 07 16:10:38 2012 +0100
+++ b/web/application.py	Fri Dec 07 17:23:04 2012 +0100
@@ -253,14 +253,11 @@
     """
 
     def __init__(self, config,
-                 session_handler_fact=CookieSessionHandler,
-                 vreg=None):
+                 session_handler_fact=CookieSessionHandler):
         self.info('starting web instance from %s', config.apphome)
-        if vreg is None:
-            vreg = cwvreg.CWRegistryStore(config)
-        self.vreg = vreg
         # connect to the repository and get instance's schema
-        self.repo = config.repository(vreg)
+        self.repo = config.repository()
+        vreg = self.vreg = self.repo.vreg
         if not vreg.initialized:
             config.init_cubes(self.repo.get_cubes())
             vreg.init_properties(self.repo.properties())
--- a/wsgi/handler.py	Fri Dec 07 16:10:38 2012 +0100
+++ b/wsgi/handler.py	Fri Dec 07 17:23:04 2012 +0100
@@ -103,8 +103,8 @@
     NOTE: no pyro
     """
 
-    def __init__(self, config, vreg=None):
-        self.appli = CubicWebPublisher(config, vreg=vreg)
+    def __init__(self, config):
+        self.appli = CubicWebPublisher(config)
         self.config = config
         self.base_url = self.config['base-url']
         self.https_url = self.config['https-url']