9 |
9 |
10 import sys |
10 import sys |
11 import threading |
11 import threading |
12 from time import time |
12 from time import time |
13 |
13 |
14 from logilab.common.deprecation import obsolete |
14 from logilab.common.deprecation import deprecated |
15 from rql.nodes import VariableRef, Function, ETYPE_PYOBJ_MAP, etype_from_pyobj |
15 from rql.nodes import VariableRef, Function, ETYPE_PYOBJ_MAP, etype_from_pyobj |
16 from yams import BASE_TYPES |
16 from yams import BASE_TYPES |
17 |
17 |
18 from cubicweb import RequestSessionMixIn, Binary, UnknownEid |
18 from cubicweb import RequestSessionMixIn, Binary, UnknownEid |
19 from cubicweb.dbapi import ConnectionProperties |
19 from cubicweb.dbapi import ConnectionProperties |
482 self.critical('wrong eid %s in repository, should check database' % value) |
482 self.critical('wrong eid %s in repository, should check database' % value) |
483 row_descr[index] = row[index] = None |
483 row_descr[index] = row[index] = None |
484 description.append(tuple(row_descr)) |
484 description.append(tuple(row_descr)) |
485 return description |
485 return description |
486 |
486 |
487 @obsolete('use direct access to session.transaction_data') |
487 @deprecated('use direct access to session.transaction_data') |
488 def query_data(self, key, default=None, setdefault=False, pop=False): |
488 def query_data(self, key, default=None, setdefault=False, pop=False): |
489 if setdefault: |
489 if setdefault: |
490 assert not pop |
490 assert not pop |
491 return self.transaction_data.setdefault(key, default) |
491 return self.transaction_data.setdefault(key, default) |
492 if pop: |
492 if pop: |
493 return self.transaction_data.pop(key, default) |
493 return self.transaction_data.pop(key, default) |
494 else: |
494 else: |
495 return self.transaction_data.get(key, default) |
495 return self.transaction_data.get(key, default) |
496 |
496 |
497 @obsolete('use entity_from_eid(eid, etype=None)') |
497 @deprecated('use entity_from_eid(eid, etype=None)') |
498 def entity(self, eid): |
498 def entity(self, eid): |
499 """return a result set for the given eid""" |
499 """return a result set for the given eid""" |
500 return self.eid_rset(eid).get_entity(0, 0) |
500 return self.eid_rset(eid).get_entity(0, 0) |
501 |
501 |
502 |
502 |