equal
deleted
inserted
replaced
76 |
76 |
77 @property |
77 @property |
78 def schema(self): |
78 def schema(self): |
79 return self.repo.schema |
79 return self.repo.schema |
80 |
80 |
|
81 def hijack_user(self, user): |
|
82 """return a fake request/session using specified user""" |
|
83 session = Session(user, self.repo) |
|
84 session._threaddata = self._threaddata |
|
85 return session |
|
86 |
81 def _change_relation(self, cb, fromeid, rtype, toeid): |
87 def _change_relation(self, cb, fromeid, rtype, toeid): |
82 if self.is_super_session: |
88 if self.is_super_session: |
83 cb(self, fromeid, rtype, toeid) |
89 cb(self, fromeid, rtype, toeid) |
84 return |
90 return |
85 self.is_super_session = True |
91 self.is_super_session = True |
112 You may use this in hooks when you know both eids of the relation you |
118 You may use this in hooks when you know both eids of the relation you |
113 want to delete. |
119 want to delete. |
114 """ |
120 """ |
115 self._change_relation(self.repo.glob_delete_relation, |
121 self._change_relation(self.repo.glob_delete_relation, |
116 fromeid, rtype, toeid) |
122 fromeid, rtype, toeid) |
|
123 |
|
124 # relations cache handling ################################################# |
117 |
125 |
118 def update_rel_cache_add(self, subject, rtype, object, symetric=False): |
126 def update_rel_cache_add(self, subject, rtype, object, symetric=False): |
119 self._update_entity_rel_cache_add(subject, rtype, 'subject', object) |
127 self._update_entity_rel_cache_add(subject, rtype, 'subject', object) |
120 if symetric: |
128 if symetric: |
121 self._update_entity_rel_cache_add(object, rtype, 'subject', subject) |
129 self._update_entity_rel_cache_add(object, rtype, 'subject', subject) |