server/sources/__init__.py
branch3.5
changeset 3041 782fa7566a22
parent 3040 e4dc22040f5f
child 3633 2d81178bea5f
child 3647 2941f4a0aab9
--- a/server/sources/__init__.py	Thu Aug 27 17:01:32 2009 +0200
+++ b/server/sources/__init__.py	Thu Aug 27 17:02:02 2009 +0200
@@ -182,6 +182,19 @@
             return wsupport
         return True
 
+    def may_cross_relation(self, rtype):
+        """return True if the relation may be crossed among sources. Rules are:
+
+        * if this source support the relation, can't be crossed unless explicitly
+          specified in .cross_relations
+
+        * if this source doesn't support the relation, can be crossed unless
+          explicitly specified in .dont_cross_relations
+        """
+        if self.support_relation(rtype):
+            return rtype in self.cross_relations
+        return rtype not in self.dont_cross_relations
+
     def eid2extid(self, eid, session=None):
         return self.repo.eid2extid(self, eid, session)