devtools/__init__.py
changeset 2732 c28b5f16f3af
parent 2657 de974465d381
child 2773 b2530e3e0afb
child 3153 93ce84956679
equal deleted inserted replaced
2731:815b93271338 2732:c28b5f16f3af
   254         else:
   254         else:
   255             return False
   255             return False
   256 
   256 
   257 CubicWebConfiguration.cls_adjust_sys_path()
   257 CubicWebConfiguration.cls_adjust_sys_path()
   258 
   258 
   259 def install_sqlite_path(querier):
   259 def install_sqlite_patch(querier):
   260     """This patch hotfixes the following sqlite bug :
   260     """This patch hotfixes the following sqlite bug :
   261        - http://www.sqlite.org/cvstrac/tktview?tn=1327,33
   261        - http://www.sqlite.org/cvstrac/tktview?tn=1327,33
   262        (some dates are returned as strings rather thant date objects)
   262        (some dates are returned as strings rather thant date objects)
   263     """
   263     """
   264     if hasattr(querier.__class__, '_devtools_sqlite_patched'):
   264     if hasattr(querier.__class__, '_devtools_sqlite_patched'):
   310         raise ValueError('no initialization function for driver %r' % driver)
   310         raise ValueError('no initialization function for driver %r' % driver)
   311     config._cubes = None # avoid assertion error
   311     config._cubes = None # avoid assertion error
   312     repo, cnx = in_memory_cnx(vreg or config, unicode(source['admin']['login']),
   312     repo, cnx = in_memory_cnx(vreg or config, unicode(source['admin']['login']),
   313                               source['admin']['password'] or 'xxx')
   313                               source['admin']['password'] or 'xxx')
   314     if driver == 'sqlite':
   314     if driver == 'sqlite':
   315         install_sqlite_path(repo.querier)
   315         install_sqlite_patch(repo.querier)
   316     return repo, cnx
   316     return repo, cnx
   317 
   317 
   318 def init_test_database_postgres(config, source, vreg=None):
   318 def init_test_database_postgres(config, source, vreg=None):
   319     """initialize a fresh sqlite databse used for testing purpose"""
   319     """initialize a fresh sqlite databse used for testing purpose"""
   320     if config.init_repository:
   320     if config.init_repository: