server/session.py
branchstable
changeset 7502 e7190f7e850e
parent 7500 cb0f4da64e86
child 7514 32081892850e
child 7526 ae31063f3274
equal deleted inserted replaced
7501:2983dd24494a 7502:e7190f7e850e
   429         """return True if the entity of the given eid is being created in the
   429         """return True if the entity of the given eid is being created in the
   430         current transaction
   430         current transaction
   431         """
   431         """
   432         return eid in self.transaction_data.get('neweids', ())
   432         return eid in self.transaction_data.get('neweids', ())
   433 
   433 
   434     def schema_rproperty(self, rtype, eidfrom, eidto, rprop):
   434     def rtype_eids_rdef(self, rtype, eidfrom, eidto):
   435         rschema = self.repo.schema[rtype]
   435         # use type_and_source_from_eid instead of type_from_eid for optimization
   436         subjtype = self.describe(eidfrom)[0]
   436         # (avoid two extra methods call)
   437         objtype = self.describe(eidto)[0]
   437         subjtype = self.repo.type_and_source_from_eid(eidfrom, self)[0]
   438         rdef = rschema.rdef(subjtype, objtype)
   438         objtype = self.repo.type_and_source_from_eid(eidto, self)[0]
   439         return rdef.get(rprop)
   439         return self.vreg.schema.rschema(rtype).rdefs[(subjtype, objtype)]
   440 
   440 
   441     # security control #########################################################
   441     # security control #########################################################
   442 
   442 
   443     DEFAULT_SECURITY = object() # evaluated to true by design
   443     DEFAULT_SECURITY = object() # evaluated to true by design
   444 
   444 
  1068             description.append(tuple(row_descr))
  1068             description.append(tuple(row_descr))
  1069         return description
  1069         return description
  1070 
  1070 
  1071     # deprecated ###############################################################
  1071     # deprecated ###############################################################
  1072 
  1072 
       
  1073     @deprecated('[3.13] use getattr(session.rtype_eids_rdef(rtype, eidfrom, eidto), prop)')
       
  1074     def schema_rproperty(self, rtype, eidfrom, eidto, rprop):
       
  1075         return getattr(self.rtype_eids_rdef(rtype, eidfrom, eidto), rprop)
       
  1076 
       
  1077 
  1073     @deprecated("[3.7] execute is now unsafe by default in hooks/operation. You"
  1078     @deprecated("[3.7] execute is now unsafe by default in hooks/operation. You"
  1074                 " can also control security with the security_enabled context "
  1079                 " can also control security with the security_enabled context "
  1075                 "manager")
  1080                 "manager")
  1076     def unsafe_execute(self, rql, kwargs=None, eid_key=None, build_descr=True,
  1081     def unsafe_execute(self, rql, kwargs=None, eid_key=None, build_descr=True,
  1077                        propagate=False):
  1082                        propagate=False):