equal
deleted
inserted
replaced
139 # resource accessors ###################################################### |
139 # resource accessors ###################################################### |
140 |
140 |
141 def actual_session(self): |
141 def actual_session(self): |
142 """return the original parent session if any, else self""" |
142 """return the original parent session if any, else self""" |
143 return self |
143 return self |
144 |
|
145 def etype_class(self, etype): |
|
146 """return an entity class for the given entity type""" |
|
147 return self.vreg.etype_class(etype) |
|
148 |
144 |
149 def system_sql(self, sql, args=None, rollback_on_failure=True): |
145 def system_sql(self, sql, args=None, rollback_on_failure=True): |
150 """return a sql cursor on the system database""" |
146 """return a sql cursor on the system database""" |
151 if not sql.split(None, 1)[0].upper() == 'SELECT': |
147 if not sql.split(None, 1)[0].upper() == 'SELECT': |
152 self.mode = 'write' |
148 self.mode = 'write' |
553 self.critical('wrong eid %s in repository, should check database' % value) |
549 self.critical('wrong eid %s in repository, should check database' % value) |
554 row_descr[index] = row[index] = None |
550 row_descr[index] = row[index] = None |
555 description.append(tuple(row_descr)) |
551 description.append(tuple(row_descr)) |
556 return description |
552 return description |
557 |
553 |
|
554 @deprecated("use vreg['etypes'].etype_class(etype)") |
|
555 def etype_class(self, etype): |
|
556 """return an entity class for the given entity type""" |
|
557 return self.vreg['etypes'].etype_class(etype) |
|
558 |
558 @deprecated('use direct access to session.transaction_data') |
559 @deprecated('use direct access to session.transaction_data') |
559 def query_data(self, key, default=None, setdefault=False, pop=False): |
560 def query_data(self, key, default=None, setdefault=False, pop=False): |
560 if setdefault: |
561 if setdefault: |
561 assert not pop |
562 assert not pop |
562 return self.transaction_data.setdefault(key, default) |
563 return self.transaction_data.setdefault(key, default) |