don't systematically init_log, it may breaks client log configuration
authorSylvain Thenault <sylvain.thenault@logilab.fr>
Fri, 05 Dec 2008 17:26:39 +0100
changeset 169 0e031b66cb0b
parent 168 f6be0c92fc38
child 174 a2966960d550
don't systematically init_log, it may breaks client log configuration
cwvreg.py
dbapi.py
--- a/cwvreg.py	Fri Dec 05 17:25:45 2008 +0100
+++ b/cwvreg.py	Fri Dec 05 17:26:39 2008 +0100
@@ -27,9 +27,10 @@
 class CubicWebRegistry(VRegistry):
     """extend the generic VRegistry with some cubicweb specific stuff"""
     
-    def __init__(self, config, debug=None):
-        # first init log service
-        config.init_log(debug=debug)
+    def __init__(self, config, debug=None, initlog=True):
+        if initlog:
+            # first init log service
+            config.init_log(debug=debug)
         super(CubicWebRegistry, self).__init__(config)
         self.schema = None
         self.reset()
@@ -342,6 +343,7 @@
         return RQLHelper(self.schema,
                          special_relations={'eid': 'uid', 'has_text': 'fti'})
 
+
 class MulCnxCubicWebRegistry(CubicWebRegistry):
     """special registry to be used when an application has to deal with
     connections to differents repository. This class add some additional wrapper
--- a/dbapi.py	Fri Dec 05 17:25:45 2008 +0100
+++ b/dbapi.py	Fri Dec 05 17:26:39 2008 +0100
@@ -74,7 +74,8 @@
     return cnx
     
 def connect(database=None, user=None, password=None, host=None,
-            group=None, cnxprops=None, port=None, setvreg=True, mulcnx=True):
+            group=None, cnxprops=None, port=None, setvreg=True, mulcnx=True,
+            initlog=True):
     """Constructor for creating a connection to the CubicWeb repository.
     Returns a Connection object.
 
@@ -97,9 +98,9 @@
         vreg = repo.vreg
     elif setvreg:
         if mulcnx:
-            vreg = MulCnxCubicWebRegistry(config)
+            vreg = MulCnxCubicWebRegistry(config, initlog=initlog)
         else:
-            vreg = CubicWebRegistry(config)
+            vreg = CubicWebRegistry(config, initlog=initlog)
         vreg.set_schema(repo.get_schema())
     else:
         vreg = None