[repository] provide a .new_session entry point
The current .connect only returns a `sessionid` which must be given to
repo._get_session(...) to get the real session object.
Related to #4151635.
--- a/server/repository.py Mon Jun 30 10:49:53 2014 +0200
+++ b/server/repository.py Thu Jul 17 14:40:28 2014 +0200
@@ -651,8 +651,8 @@
query_attrs)
return rset.rows
- def connect(self, login, **kwargs):
- """open a session for a given user
+ def new_session(self, login, **kwargs):
+ """open a new session for a given user
raise `AuthenticationError` if the authentication failed
raise `ConnectionError` if we can't open a connection
@@ -678,7 +678,11 @@
# commit connection at this point in case write operation has been
# done during `session_open` hooks
cnx.commit()
- return session.sessionid
+ return session
+
+ def connect(self, login, **kwargs):
+ """open a new session for a given user and return its sessionid """
+ return self.new_session(login, **kwargs).sessionid
def execute(self, sessionid, rqlstring, args=None, build_descr=True,
txid=None):