server/repository.py
changeset 1228 91ae10ffb611
parent 1217 b5beb1946019
child 1250 5c20a7f13c84
--- a/server/repository.py	Thu Apr 02 18:52:08 2009 +0200
+++ b/server/repository.py	Fri Apr 03 19:04:00 2009 +0200
@@ -901,11 +901,6 @@
             source = subjsource
         return source
     
-    @cached
-    def rel_type_sources(self, rtype):
-        return [source for source in self.sources
-                if source.support_relation(rtype) or rtype in source.dont_cross_relations]
-    
     def locate_etype_source(self, etype):
         for source in self.sources:
             if source.support_entity(etype, 1):
@@ -1099,6 +1094,26 @@
                 pass
         return nameserver
 
+    # multi-sources planner helpers ###########################################
+    
+    @cached
+    def rel_type_sources(self, rtype):
+        return [source for source in self.sources
+                if source.support_relation(rtype)
+                or rtype in source.dont_cross_relations]
+    
+    @cached
+    def can_cross_relation(self, rtype):
+        return [source for source in self.sources
+                if source.support_relation(rtype)
+                and rtype in source.cross_relations]
+    
+    @cached
+    def is_multi_sources_relation(self, rtype):
+        return any(source for source in self.sources
+                   if not source is self.system_source
+                   and source.support_relation(rtype))
+    
 
 def pyro_unregister(config):
     """unregister the repository from the pyro name server"""