equal
deleted
inserted
replaced
73 |
73 |
74 def __str__(self): |
74 def __str__(self): |
75 return '<%ssession %s (%s 0x%x)>' % (self.cnxtype, self.user.login, |
75 return '<%ssession %s (%s 0x%x)>' % (self.cnxtype, self.user.login, |
76 self.id, id(self)) |
76 self.id, id(self)) |
77 |
77 |
78 @property |
|
79 def schema(self): |
|
80 return self.repo.schema |
|
81 |
|
82 def add_relation(self, fromeid, rtype, toeid): |
78 def add_relation(self, fromeid, rtype, toeid): |
83 if self.is_super_session: |
79 if self.is_super_session: |
84 self.repo.glob_add_relation(self, fromeid, rtype, toeid) |
80 self.repo.glob_add_relation(self, fromeid, rtype, toeid) |
85 return |
81 return |
86 self.is_super_session = True |
82 self.is_super_session = True |
276 else: |
272 else: |
277 self.data[key] = value |
273 self.data[key] = value |
278 |
274 |
279 # request interface ####################################################### |
275 # request interface ####################################################### |
280 |
276 |
|
277 @property |
|
278 def cursor(self): |
|
279 """return a rql cursor""" |
|
280 return self |
|
281 |
281 def set_entity_cache(self, entity): |
282 def set_entity_cache(self, entity): |
282 # XXX session level caching may be a pb with multiple repository |
283 # XXX session level caching may be a pb with multiple repository |
283 # instances, but 1. this is probably not the only one :$ and 2. it |
284 # instances, but 1. this is probably not the only one :$ and 2. it |
284 # may be an acceptable risk. Anyway we could activate it or not |
285 # may be an acceptable risk. Anyway we could activate it or not |
285 # according to a configuration option |
286 # according to a configuration option |
361 set instead of the parent session, hence further query done through |
362 set instead of the parent session, hence further query done through |
362 entities fetched from this result set will bypass security as well |
363 entities fetched from this result set will bypass security as well |
363 """ |
364 """ |
364 return self.super_session.execute(rql, kwargs, eid_key, build_descr, |
365 return self.super_session.execute(rql, kwargs, eid_key, build_descr, |
365 propagate) |
366 propagate) |
366 |
|
367 @property |
|
368 def cursor(self): |
|
369 """return a rql cursor""" |
|
370 return self |
|
371 |
367 |
372 def execute(self, rql, kwargs=None, eid_key=None, build_descr=True, |
368 def execute(self, rql, kwargs=None, eid_key=None, build_descr=True, |
373 propagate=False): |
369 propagate=False): |
374 """db-api like method directly linked to the querier execute method |
370 """db-api like method directly linked to the querier execute method |
375 |
371 |
483 return self._threaddata.pending_operations |
479 return self._threaddata.pending_operations |
484 except AttributeError: |
480 except AttributeError: |
485 self._threaddata.pending_operations = [] |
481 self._threaddata.pending_operations = [] |
486 return self._threaddata.pending_operations |
482 return self._threaddata.pending_operations |
487 |
483 |
488 |
|
489 def add_operation(self, operation, index=None): |
484 def add_operation(self, operation, index=None): |
490 """add an observer""" |
485 """add an observer""" |
491 assert self.commit_state != 'commit' |
486 assert self.commit_state != 'commit' |
492 if index is not None: |
487 if index is not None: |
493 self.pending_operations.insert(index, operation) |
488 self.pending_operations.insert(index, operation) |
563 self.critical('wrong eid %s in repository, should check database' % value) |
558 self.critical('wrong eid %s in repository, should check database' % value) |
564 row_descr[index] = row[index] = None |
559 row_descr[index] = row[index] = None |
565 description.append(tuple(row_descr)) |
560 description.append(tuple(row_descr)) |
566 return description |
561 return description |
567 |
562 |
|
563 # deprecated ############################################################### |
|
564 |
|
565 @property |
|
566 @deprecated("[3.5] use session.vreg.schema") |
|
567 def schema(self): |
|
568 return self.repo.schema |
|
569 |
568 @deprecated("[3.4] use vreg['etypes'].etype_class(etype)") |
570 @deprecated("[3.4] use vreg['etypes'].etype_class(etype)") |
569 def etype_class(self, etype): |
571 def etype_class(self, etype): |
570 """return an entity class for the given entity type""" |
572 """return an entity class for the given entity type""" |
571 return self.vreg['etypes'].etype_class(etype) |
573 return self.vreg['etypes'].etype_class(etype) |
572 |
574 |