web/facet.py
changeset 4087 2b8bc4cfd6ee
parent 4074 9cce43f52c61
child 4089 ff92c7d692bf
--- a/web/facet.py	Wed Dec 09 16:07:07 2009 +0100
+++ b/web/facet.py	Wed Dec 09 16:33:32 2009 +0100
@@ -411,20 +411,16 @@
     @cached
     def support_and(self):
         rschema = self._cw.vreg.schema.rschema(self.rtype)
-        if self.role == 'subject':
-            cardidx = 0
-        else:
-            cardidx = 1
         # XXX when called via ajax, no rset to compute possible types
         possibletypes = self.cw_rset and self.cw_rset.column_types(0)
-        for subjtype, objtype in rschema.iter_rdefs():
+        for rdef in rschema.rdefs.itervalues():
             if possibletypes is not None:
                 if self.role == 'subject':
-                    if not subjtype in possibletypes:
+                    if not rdef.subject in possibletypes:
                         continue
-                elif not objtype in possibletypes:
+                elif not rdef.object in possibletypes:
                     continue
-            if rschema.rproperty(subjtype, objtype, 'cardinality')[cardidx] in '+*':
+            if rdef.role_cardinality(role) in '+*':
                 return True
         return False