selectors.py
branchtls-sprint
changeset 1132 96752791c2b6
parent 1037 1f3fae8d82b2
child 1138 22f634977c95
equal deleted inserted replaced
1131:544609e83317 1132:96752791c2b6
    51 
    51 
    52 from yams import BASE_TYPES
    52 from yams import BASE_TYPES
    53 
    53 
    54 from cubicweb import Unauthorized, NoSelectableObject, NotAnEntity, role
    54 from cubicweb import Unauthorized, NoSelectableObject, NotAnEntity, role
    55 from cubicweb.vregistry import (NoSelectableObject, Selector,
    55 from cubicweb.vregistry import (NoSelectableObject, Selector,
    56                                 chainall, chainfirst, objectify_selector)
    56                                 chainall, objectify_selector)
    57 from cubicweb.cwconfig import CubicWebConfiguration
    57 from cubicweb.cwconfig import CubicWebConfiguration
    58 from cubicweb.schema import split_expression
    58 from cubicweb.schema import split_expression
    59 
    59 
    60 # helpers for debugging selectors
    60 # helpers for debugging selectors
    61 SELECTOR_LOGGER = logging.getLogger('cubicweb.selectors')
    61 SELECTOR_LOGGER = logging.getLogger('cubicweb.selectors')
   617             try:
   617             try:
   618                 if self.role == 'subject':
   618                 if self.role == 'subject':
   619                     return int(self.target_etype in rschema.objects(eschema))
   619                     return int(self.target_etype in rschema.objects(eschema))
   620                 else:
   620                 else:
   621                     return int(self.target_etype in rschema.subjects(eschema))
   621                     return int(self.target_etype in rschema.subjects(eschema))
   622             except KeyError, ex:
   622             except KeyError:
   623                 return 0
   623                 return 0
   624         return 1
   624         return 1
   625 
   625 
   626 
   626 
   627 class partial_relation_possible(PartialSelectorMixIn, relation_possible):
   627 class partial_relation_possible(PartialSelectorMixIn, relation_possible):