equal
deleted
inserted
replaced
649 rset = session.execute(rql + ','.join('X %s %%(%s)s' % (attr, attr) |
649 rset = session.execute(rql + ','.join('X %s %%(%s)s' % (attr, attr) |
650 for attr in query_attrs), |
650 for attr in query_attrs), |
651 query_attrs) |
651 query_attrs) |
652 return rset.rows |
652 return rset.rows |
653 |
653 |
654 def connect(self, login, **kwargs): |
654 def new_session(self, login, **kwargs): |
655 """open a session for a given user |
655 """open a new session for a given user |
656 |
656 |
657 raise `AuthenticationError` if the authentication failed |
657 raise `AuthenticationError` if the authentication failed |
658 raise `ConnectionError` if we can't open a connection |
658 raise `ConnectionError` if we can't open a connection |
659 """ |
659 """ |
660 cnxprops = kwargs.pop('cnxprops', None) |
660 cnxprops = kwargs.pop('cnxprops', None) |
676 with session.new_cnx() as cnx: |
676 with session.new_cnx() as cnx: |
677 self.hm.call_hooks('session_open', cnx) |
677 self.hm.call_hooks('session_open', cnx) |
678 # commit connection at this point in case write operation has been |
678 # commit connection at this point in case write operation has been |
679 # done during `session_open` hooks |
679 # done during `session_open` hooks |
680 cnx.commit() |
680 cnx.commit() |
681 return session.sessionid |
681 return session |
|
682 |
|
683 def connect(self, login, **kwargs): |
|
684 """open a new session for a given user and return its sessionid """ |
|
685 return self.new_session(login, **kwargs).sessionid |
682 |
686 |
683 def execute(self, sessionid, rqlstring, args=None, build_descr=True, |
687 def execute(self, sessionid, rqlstring, args=None, build_descr=True, |
684 txid=None): |
688 txid=None): |
685 """execute a RQL query |
689 """execute a RQL query |
686 |
690 |