dbapi.py
branchstable
changeset 7004 9e142116d82f
parent 6613 e7ff604491b2
child 7006 d0f635d3a6bb
child 7056 51f88f13d6f3
equal deleted inserted replaced
7003:6eeed1e9782c 7004:9e142116d82f
   166       flag telling if logging should be initialized. You usually don't want
   166       flag telling if logging should be initialized. You usually don't want
   167       logging initialization when establishing the connection from a process
   167       logging initialization when establishing the connection from a process
   168       where it's already initialized.
   168       where it's already initialized.
   169 
   169 
   170     :kwargs:
   170     :kwargs:
   171       there goes authentication tokens. You usually have to specify for
   171       there goes authentication tokens. You usually have to specify a password
   172       instance a password for the given user, using a named 'password' argument.
   172       for the given user, using a named 'password' argument.
   173     """
   173     """
   174     config = cwconfig.CubicWebNoAppConfiguration()
       
   175     if host:
       
   176         config.global_set_option('pyro-ns-host', host)
       
   177     if group:
       
   178         config.global_set_option('pyro-ns-group', group)
       
   179     cnxprops = cnxprops or ConnectionProperties()
   174     cnxprops = cnxprops or ConnectionProperties()
   180     method = cnxprops.cnxtype
   175     method = cnxprops.cnxtype
       
   176     if method == 'pyro':
       
   177         config = cwconfig.CubicWebNoAppConfiguration()
       
   178         if host:
       
   179             config.global_set_option('pyro-ns-host', host)
       
   180         if group:
       
   181             config.global_set_option('pyro-ns-group', group)
       
   182     else:
       
   183         assert database
       
   184         config = cwconfig.instance_configuration(database)
   181     repo = get_repository(method, database, config=config)
   185     repo = get_repository(method, database, config=config)
   182     if method == 'inmemory':
   186     if method == 'inmemory':
   183         vreg = repo.vreg
   187         vreg = repo.vreg
   184     elif setvreg:
   188     elif setvreg:
   185         if mulcnx:
   189         if mulcnx: