diff -r 7beb71d76d82 -r 32081892850e server/session.py --- a/server/session.py Sat Jun 11 09:22:25 2011 +0200 +++ b/server/session.py Wed Jun 15 17:16:19 2011 +0200 @@ -74,6 +74,13 @@ """ return req.is_internal_session +@objectify_selector +def repairing(cls, req, **kwargs): + """repository side only selector returning 1 if the session is not a regular + user session but an internal session + """ + return req.vreg.config.repairing + class transaction(object): """context manager to enter a transaction for a session: when exiting the @@ -476,12 +483,12 @@ """ return eid in self.transaction_data.get('neweids', ()) - def schema_rproperty(self, rtype, eidfrom, eidto, rprop): - rschema = self.repo.schema[rtype] - subjtype = self.describe(eidfrom)[0] - objtype = self.describe(eidto)[0] - rdef = rschema.rdef(subjtype, objtype) - return rdef.get(rprop) + def rtype_eids_rdef(self, rtype, eidfrom, eidto): + # use type_and_source_from_eid instead of type_from_eid for optimization + # (avoid two extra methods call) + subjtype = self.repo.type_and_source_from_eid(eidfrom, self)[0] + objtype = self.repo.type_and_source_from_eid(eidto, self)[0] + return self.vreg.schema.rschema(rtype).rdefs[(subjtype, objtype)] # security control ######################################################### @@ -1190,6 +1197,10 @@ # deprecated ############################################################### + @deprecated('[3.13] use getattr(session.rtype_eids_rdef(rtype, eidfrom, eidto), prop)') + def schema_rproperty(self, rtype, eidfrom, eidto, rprop): + return getattr(self.rtype_eids_rdef(rtype, eidfrom, eidto), rprop) + @property @deprecated("[3.13] use .cnxset attribute instead of .pool") def pool(self):