# HG changeset patch # User Sylvain Thénault # Date 1357854767 -3600 # Node ID 8ea63a2cc2cc0c097163406f7f19e379dd200263 # Parent e8afecc3b5769fa2cb3ce9aead6c203f16882219 [db-api] rename repo_connect into _repo_connect to mark it private. Closes #2521848 diff -r e8afecc3b576 -r 8ea63a2cc2cc dbapi.py --- a/dbapi.py Thu Jan 10 22:51:10 2013 +0100 +++ b/dbapi.py Thu Jan 10 22:52:47 2013 +0100 @@ -132,7 +132,7 @@ raise ConnectionError('unknown protocol: `%s`' % method) -def repo_connect(repo, login, **kwargs): +def _repo_connect(repo, login, **kwargs): """Constructor to create a new connection to the given CubicWeb repository. Returns a Connection instance. @@ -233,7 +233,7 @@ vreg.set_schema(schema) else: vreg = None - cnx = repo_connect(repo, login, cnxprops=cnxprops, **kwargs) + cnx = _repo_connect(repo, login, cnxprops=cnxprops, **kwargs) cnx.vreg = vreg return cnx @@ -253,7 +253,7 @@ """ # connection to the CubicWeb repository repo = in_memory_repo(config) - return repo, repo_connect(repo, login, **kwargs) + return repo, _repo_connect(repo, login, **kwargs) # XXX web only method, move to webconfig? def anonymous_session(vreg): @@ -267,7 +267,7 @@ anon_login, anon_password = anoninfo # use vreg's repository cache repo = vreg.config.repository(vreg) - anon_cnx = repo_connect(repo, anon_login, password=anon_password) + anon_cnx = _repo_connect(repo, anon_login, password=anon_password) anon_cnx.vreg = vreg return DBAPISession(anon_cnx, anon_login) @@ -877,4 +877,4 @@ return self._repo.undo_transaction(self.sessionid, txuuid, **self._txid()) -in_memory_cnx = deprecated('[3.16] use repo_connect instead)')(repo_connect) +in_memory_cnx = deprecated('[3.16] use _repo_connect instead)')(_repo_connect) diff -r e8afecc3b576 -r 8ea63a2cc2cc devtools/__init__.py --- a/devtools/__init__.py Thu Jan 10 22:51:10 2013 +0100 +++ b/devtools/__init__.py Thu Jan 10 22:52:47 2013 +0100 @@ -386,12 +386,12 @@ def get_cnx(self): """return Connection object on the current repository""" - from cubicweb.dbapi import repo_connect + from cubicweb.dbapi import _repo_connect repo = self.get_repo() sources = self.config.sources() login = unicode(sources['admin']['login']) password = sources['admin']['password'] or 'xxx' - cnx = repo_connect(repo, login, password=password) + cnx = _repo_connect(repo, login, password=password) return cnx def get_repo_and_cnx(self, db_id=DEFAULT_EMPTY_DB_ID): diff -r e8afecc3b576 -r 8ea63a2cc2cc devtools/testlib.py --- a/devtools/testlib.py Thu Jan 10 22:51:10 2013 +0100 +++ b/devtools/testlib.py Thu Jan 10 22:52:47 2013 +0100 @@ -403,7 +403,7 @@ autoclose = kwargs.pop('autoclose', True) if not kwargs: kwargs['password'] = str(login) - self.set_cnx(dbapi.repo_connect(self.repo, unicode(login), **kwargs)) + self.set_cnx(dbapi._repo_connect(self.repo, unicode(login), **kwargs)) self.websession = dbapi.DBAPISession(self.cnx) if login == self.vreg.config.anonymous_user()[0]: self.cnx.anonymous_connection = True diff -r e8afecc3b576 -r 8ea63a2cc2cc doc/3.16.rst --- a/doc/3.16.rst Thu Jan 10 22:51:10 2013 +0100 +++ b/doc/3.16.rst Thu Jan 10 22:52:47 2013 +0100 @@ -33,6 +33,8 @@ `Session`. The former is replaced by a is_repo_in_memory property and the later is totaly useless. + * Turn `repo_connect` into `_repo_connect` to mark it as private function. + * Deprecate `in_memory_cnx` which becomes useless, use `_repo_connect` instead if necessary. diff -r e8afecc3b576 -r 8ea63a2cc2cc server/migractions.py --- a/server/migractions.py Thu Jan 10 22:51:10 2013 +0100 +++ b/server/migractions.py Thu Jan 10 22:52:47 2013 +0100 @@ -56,7 +56,7 @@ PURE_VIRTUAL_RTYPES, CubicWebRelationSchema, order_eschemas) from cubicweb.cwvreg import CW_EVENT_MANAGER -from cubicweb.dbapi import get_repository, repo_connect +from cubicweb.dbapi import get_repository, _repo_connect from cubicweb.migration import MigrationHelper, yes from cubicweb.server import hook try: @@ -279,7 +279,7 @@ login, pwd = manager_userpasswd() while True: try: - self._cnx = repo_connect(self.repo, login, password=pwd) + self._cnx = _repo_connect(self.repo, login, password=pwd) if not 'managers' in self._cnx.user(self.session).groups: print 'migration need an account in the managers group' else: diff -r e8afecc3b576 -r 8ea63a2cc2cc web/views/authentication.py --- a/web/views/authentication.py Thu Jan 10 22:51:10 2013 +0100 +++ b/web/views/authentication.py Thu Jan 10 22:52:47 2013 +0100 @@ -27,7 +27,7 @@ from cubicweb import AuthenticationError, BadConnectionId from cubicweb.view import Component -from cubicweb.dbapi import repo_connect, ConnectionProperties +from cubicweb.dbapi import _repo_connect, ConnectionProperties from cubicweb.web import InvalidSession from cubicweb.web.application import AbstractAuthenticationManager @@ -170,7 +170,7 @@ def _authenticate(self, login, authinfo): cnxprops = ConnectionProperties(close=False, log=self.log_queries) - cnx = repo_connect(self.repo, login, cnxprops=cnxprops, **authinfo) + cnx = _repo_connect(self.repo, login, cnxprops=cnxprops, **authinfo) # decorate connection cnx.vreg = self.vreg return cnx