selectors.py
changeset 7990 a673d1d9a738
parent 7986 552d41237156
child 8032 bcb87336c7d2
equal deleted inserted replaced
7989:db76e8aaec29 7990:a673d1d9a738
  1025                                                         action, **kwargs)
  1025                                                         action, **kwargs)
  1026 
  1026 
  1027     def complete(self, cls):
  1027     def complete(self, cls):
  1028         self.rtype = cls.rtype
  1028         self.rtype = cls.rtype
  1029         self.role = role(cls)
  1029         self.role = role(cls)
  1030         self.target_etype = getattr(cls, 'etype', None)
  1030         self.target_etype = getattr(cls, 'target_etype', None)
  1031         if self.target_etype is not None:
       
  1032             warn('[3.6] please rename etype to target_etype on %s' % cls,
       
  1033                  DeprecationWarning)
       
  1034         else:
       
  1035             self.target_etype = getattr(cls, 'target_etype', None)
       
  1036 
  1031 
  1037 
  1032 
  1038 class has_related_entities(EntitySelector):
  1033 class has_related_entities(EntitySelector):
  1039     """Return 1 if entity support the specified relation and has some linked
  1034     """Return 1 if entity support the specified relation and has some linked
  1040     entities by this relation , optionaly filtered according to the specified
  1035     entities by this relation , optionaly filtered according to the specified
  1082                                                            **kwargs)
  1077                                                            **kwargs)
  1083 
  1078 
  1084     def complete(self, cls):
  1079     def complete(self, cls):
  1085         self.rtype = cls.rtype
  1080         self.rtype = cls.rtype
  1086         self.role = role(cls)
  1081         self.role = role(cls)
  1087         self.target_etype = getattr(cls, 'etype', None)
  1082         self.target_etype = getattr(cls, 'target_etype', None)
  1088         if self.target_etype is not None:
       
  1089             warn('[3.6] please rename etype to target_etype on %s' % cls,
       
  1090                  DeprecationWarning)
       
  1091         else:
       
  1092             self.target_etype = getattr(cls, 'target_etype', None)
       
  1093 
  1083 
  1094 
  1084 
  1095 class has_permission(EntitySelector):
  1085 class has_permission(EntitySelector):
  1096     """Return non-zero score if request's user has the permission to do the
  1086     """Return non-zero score if request's user has the permission to do the
  1097     requested action on the entity. `action` is an entity schema action (eg one
  1087     requested action on the entity. `action` is an entity schema action (eg one