server/session.py
changeset 3163 edfe43ceaa35
parent 3085 b415bca9a9ed
parent 3162 d6ae24439bee
child 3199 fc63b80ec979
--- a/server/session.py	Wed Sep 02 16:42:07 2009 +0200
+++ b/server/session.py	Thu Sep 10 08:13:22 2009 +0200
@@ -75,6 +75,12 @@
         return '<%ssession %s (%s 0x%x)>' % (self.cnxtype, self.user.login,
                                              self.id, id(self))
 
+    def hijack_user(self, user):
+        """return a fake request/session using specified user"""
+        session = Session(user, self.repo)
+        session._threaddata = self.actual_session()._threaddata
+        return session
+
     def _change_relation(self, cb, fromeid, rtype, toeid):
         if self.is_super_session:
             cb(self, fromeid, rtype, toeid)
@@ -112,6 +118,8 @@
         self._change_relation(self.repo.glob_delete_relation,
                               fromeid, rtype, toeid)
 
+    # relations cache handling #################################################
+
     def update_rel_cache_add(self, subject, rtype, object, symetric=False):
         self._update_entity_rel_cache_add(subject, rtype, 'subject', object)
         if symetric: