409 for entity in rset.entities()] |
409 for entity in rset.entities()] |
410 |
410 |
411 @cached |
411 @cached |
412 def support_and(self): |
412 def support_and(self): |
413 rschema = self._cw.vreg.schema.rschema(self.rtype) |
413 rschema = self._cw.vreg.schema.rschema(self.rtype) |
414 if self.role == 'subject': |
|
415 cardidx = 0 |
|
416 else: |
|
417 cardidx = 1 |
|
418 # XXX when called via ajax, no rset to compute possible types |
414 # XXX when called via ajax, no rset to compute possible types |
419 possibletypes = self.cw_rset and self.cw_rset.column_types(0) |
415 possibletypes = self.cw_rset and self.cw_rset.column_types(0) |
420 for subjtype, objtype in rschema.iter_rdefs(): |
416 for rdef in rschema.rdefs.itervalues(): |
421 if possibletypes is not None: |
417 if possibletypes is not None: |
422 if self.role == 'subject': |
418 if self.role == 'subject': |
423 if not subjtype in possibletypes: |
419 if not rdef.subject in possibletypes: |
424 continue |
420 continue |
425 elif not objtype in possibletypes: |
421 elif not rdef.object in possibletypes: |
426 continue |
422 continue |
427 if rschema.rproperty(subjtype, objtype, 'cardinality')[cardidx] in '+*': |
423 if rdef.role_cardinality(role) in '+*': |
428 return True |
424 return True |
429 return False |
425 return False |
430 |
426 |
431 def add_rql_restrictions(self): |
427 def add_rql_restrictions(self): |
432 """add restriction for this facet into the rql syntax tree""" |
428 """add restriction for this facet into the rql syntax tree""" |