server/session.py
changeset 8844 168cf5ef21f8
parent 8843 ea05b8545dd8
child 8845 667cc27e9d12
equal deleted inserted replaced
8843:ea05b8545dd8 8844:168cf5ef21f8
   644 
   644 
   645     def transaction_inc_action_counter(self):
   645     def transaction_inc_action_counter(self):
   646         num = self.data.setdefault('tx_action_count', 0) + 1
   646         num = self.data.setdefault('tx_action_count', 0) + 1
   647         self.data['tx_action_count'] = num
   647         self.data['tx_action_count'] = num
   648         return num
   648         return num
       
   649     # db-api like interface ###################################################
       
   650 
       
   651     def source_defs(self):
       
   652         return self.repo.source_defs()
       
   653 
       
   654     def describe(self, eid, asdict=False):
       
   655         """return a tuple (type, sourceuri, extid) for the entity with id <eid>"""
       
   656         metas = self.repo.type_and_source_from_eid(eid, self)
       
   657         if asdict:
       
   658             return dict(zip(('type', 'source', 'extid', 'asource'), metas))
       
   659        # XXX :-1 for cw compat, use asdict=True for full information
       
   660         return metas[:-1]
       
   661 
       
   662 
       
   663     def source_from_eid(self, eid):
       
   664         """return the source where the entity with id <eid> is located"""
       
   665         return self.repo.source_from_eid(eid, self)
   649 
   666 
   650 
   667 
   651 def tx_attr(attr_name, writable=False):
   668 def tx_attr(attr_name, writable=False):
   652     """return a property to forward attribute access to transaction.
   669     """return a property to forward attribute access to transaction.
   653 
   670 
  1139         """return the id (string) of the controller issuing the request (no
  1156         """return the id (string) of the controller issuing the request (no
  1140         sense here, always return 'view')
  1157         sense here, always return 'view')
  1141         """
  1158         """
  1142         return 'view'
  1159         return 'view'
  1143 
  1160 
  1144     def source_defs(self):
  1161     source_defs = tx_meth('source_defs')
  1145         return self.repo.source_defs()
  1162     describe = tx_meth('describe')
  1146 
  1163     source_from_eid = tx_meth('source_from_eid')
  1147     def describe(self, eid, asdict=False):
  1164 
  1148         """return a tuple (type, sourceuri, extid) for the entity with id <eid>"""
       
  1149         metas = self.repo.type_and_source_from_eid(eid, self)
       
  1150         if asdict:
       
  1151             return dict(zip(('type', 'source', 'extid', 'asource'), metas))
       
  1152        # XXX :-1 for cw compat, use asdict=True for full information
       
  1153         return metas[:-1]
       
  1154 
       
  1155     # db-api like interface ###################################################
       
  1156 
       
  1157     def source_from_eid(self, eid):
       
  1158         """return the source where the entity with id <eid> is located"""
       
  1159         return self.repo.source_from_eid(eid, self)
       
  1160 
  1165 
  1161     def execute(self, rql, kwargs=None, eid_key=None, build_descr=True):
  1166     def execute(self, rql, kwargs=None, eid_key=None, build_descr=True):
  1162         """db-api like method directly linked to the querier execute method.
  1167         """db-api like method directly linked to the querier execute method.
  1163 
  1168 
  1164         See :meth:`cubicweb.dbapi.Cursor.execute` documentation.
  1169         See :meth:`cubicweb.dbapi.Cursor.execute` documentation.