entity.py
branch3.5
changeset 3184 613064b49331
parent 3165 0a50ebe53db7
parent 3130 2486163c4630
child 3185 bd0126d17e83
child 3212 07d11bacfefe
--- a/entity.py	Fri Sep 11 12:42:37 2009 +0200
+++ b/entity.py	Fri Sep 11 15:55:15 2009 +0200
@@ -682,14 +682,16 @@
         self.set_related_cache(rtype, role, rset)
         return self.related(rtype, role, limit, entities)
 
-    def related_rql(self, rtype, role='subject'):
+    def related_rql(self, rtype, role='subject', targettypes=None):
         rschema = self.schema[rtype]
         if role == 'subject':
-            targettypes = rschema.objects(self.e_schema)
+            if targettypes is None:
+                targettypes = rschema.objects(self.e_schema)
             restriction = 'E eid %%(x)s, E %s X' % rtype
             card = greater_card(rschema, (self.e_schema,), targettypes, 0)
         else:
-            targettypes = rschema.subjects(self.e_schema)
+            if targettypes is None:
+                targettypes = rschema.subjects(self.e_schema)
             restriction = 'E eid %%(x)s, X %s E' % rtype
             card = greater_card(rschema, targettypes, (self.e_schema,), 1)
         if len(targettypes) > 1: