server/repository.py
changeset 9496 e699fbcc9a61
parent 9491 e82370a30018
child 9505 53225f66e7ca
equal deleted inserted replaced
9495:0ae4e6d7ce2f 9496:e699fbcc9a61
   691             assert self._pyro_sessions[threading.currentThread()] == None
   691             assert self._pyro_sessions[threading.currentThread()] == None
   692             self.debug('record session %s', session)
   692             self.debug('record session %s', session)
   693             self._pyro_sessions[threading.currentThread()] = session
   693             self._pyro_sessions[threading.currentThread()] = session
   694         user._cw = user.cw_rset.req = session
   694         user._cw = user.cw_rset.req = session
   695         user.cw_clear_relation_cache()
   695         user.cw_clear_relation_cache()
   696         self._sessions[session.id] = session
   696         self._sessions[session.sessionid] = session
   697         self.info('opened session %s for user %s', session.id, login)
   697         self.info('opened session %s for user %s', session.sessionid, login)
   698         self.hm.call_hooks('session_open', session)
   698         self.hm.call_hooks('session_open', session)
   699         # commit session at this point in case write operation has been done
   699         # commit session at this point in case write operation has been done
   700         # during `session_open` hooks
   700         # during `session_open` hooks
   701         session.commit()
   701         session.commit()
   702         return session.id
   702         return session.sessionid
   703 
   703 
   704     def execute(self, sessionid, rqlstring, args=None, build_descr=True,
   704     def execute(self, sessionid, rqlstring, args=None, build_descr=True,
   705                 txid=None):
   705                 txid=None):
   706         """execute a RQL query
   706         """execute a RQL query
   707 
   707 
   899         self.debug('cleaning session unused since %s',
   899         self.debug('cleaning session unused since %s',
   900                    strftime('%T', localtime(mintime)))
   900                    strftime('%T', localtime(mintime)))
   901         nbclosed = 0
   901         nbclosed = 0
   902         for session in self._sessions.values():
   902         for session in self._sessions.values():
   903             if session.timestamp < mintime:
   903             if session.timestamp < mintime:
   904                 self.close(session.id)
   904                 self.close(session.sessionid)
   905                 nbclosed += 1
   905                 nbclosed += 1
   906         return nbclosed
   906         return nbclosed
   907 
   907 
   908     @deprecated("[3.19] use internal_cnx now\n"
   908     @deprecated("[3.19] use internal_cnx now\n"
   909                 "(Beware that integrity hook are now enabled by default)")
   909                 "(Beware that integrity hook are now enabled by default)")
  1469             session = sessions.pop(threading.currentThread(), None)
  1469             session = sessions.pop(threading.currentThread(), None)
  1470             if session is None:
  1470             if session is None:
  1471                 # client was not yet connected to the repo
  1471                 # client was not yet connected to the repo
  1472                 return
  1472                 return
  1473             if not session.closed:
  1473             if not session.closed:
  1474                 self.close(session.id)
  1474                 self.close(session.sessionid)
  1475         daemon.removeConnection = removeConnection
  1475         daemon.removeConnection = removeConnection
  1476         return daemon
  1476         return daemon
  1477 
  1477 
  1478     def _ensure_pyro_ns(self):
  1478     def _ensure_pyro_ns(self):
  1479         if not self._use_pyrons():
  1479         if not self._use_pyrons():