equal
deleted
inserted
replaced
163 vreg, eschema = cls_or_inst.vreg, cls_or_inst.e_schema |
163 vreg, eschema = cls_or_inst.vreg, cls_or_inst.e_schema |
164 for iface in self.expected_ifaces: |
164 for iface in self.expected_ifaces: |
165 if isinstance(iface, basestring): |
165 if isinstance(iface, basestring): |
166 # entity type |
166 # entity type |
167 try: |
167 try: |
168 iface = vreg.etype_class(iface) |
168 iface = vreg['etypes'].etype_class(iface) |
169 except KeyError: |
169 except KeyError: |
170 continue # entity type not in the schema |
170 continue # entity type not in the schema |
171 score += score_interface(cls_or_inst, cls, iface) |
171 score += score_interface(cls_or_inst, cls, iface) |
172 return score |
172 return score |
173 |
173 |
210 return score |
210 return score |
211 |
211 |
212 def score(self, cls, req, etype): |
212 def score(self, cls, req, etype): |
213 if etype in BASE_TYPES: |
213 if etype in BASE_TYPES: |
214 return 0 |
214 return 0 |
215 return self.score_class(cls.vreg.etype_class(etype), req) |
215 return self.score_class(cls.vreg['etypes'].etype_class(etype), req) |
216 |
216 |
217 def score_class(self, eclass, req): |
217 def score_class(self, eclass, req): |
218 raise NotImplementedError() |
218 raise NotImplementedError() |
219 |
219 |
220 |
220 |
568 """ |
568 """ |
569 def __init__(self, registry, oid): |
569 def __init__(self, registry, oid): |
570 self.registry = registry |
570 self.registry = registry |
571 self.oid = oid |
571 self.oid = oid |
572 |
572 |
573 def __call__(self, cls, req, rset=None, *args, **kwargs): |
573 def __call__(self, cls, req, **kwargs): |
574 try: |
574 try: |
575 cls.vreg.select(self.registry, self.oid, req, rset=rset, **kwargs) |
575 cls.vreg[self.registry].select(self.oid, req, **kwargs) |
576 return 1 |
576 return 1 |
577 except NoSelectableObject: |
577 except NoSelectableObject: |
578 return 0 |
578 return 0 |
579 |
579 |
580 |
580 |
628 try: |
628 try: |
629 etype = cls.vreg.case_insensitive_etypes[etype.lower()] |
629 etype = cls.vreg.case_insensitive_etypes[etype.lower()] |
630 req.form['etype'] = etype |
630 req.form['etype'] = etype |
631 except KeyError: |
631 except KeyError: |
632 return 0 |
632 return 0 |
633 return self.score_class(cls.vreg.etype_class(etype), req) |
633 return self.score_class(cls.vreg['etypes'].etype_class(etype), req) |
634 |
634 |
635 |
635 |
636 class entity_implements(ImplementsMixIn, EntitySelector): |
636 class entity_implements(ImplementsMixIn, EntitySelector): |
637 """accept if entity instances found in the result set implements at least one |
637 """accept if entity instances found in the result set implements at least one |
638 of the interfaces given as argument. Returned score is the number of |
638 of the interfaces given as argument. Returned score is the number of |