diff -r caef98aa4a98 -r 59220b704562 server/sources/__init__.py --- a/server/sources/__init__.py Thu Sep 17 19:38:04 2009 +0200 +++ b/server/sources/__init__.py Fri Sep 18 11:24:37 2009 +0200 @@ -80,6 +80,11 @@ # a reference to the instance'schema (may differs from the source'schema) schema = None + # multi-sources planning control + dont_cross_relations = () + cross_relations = () + + def __init__(self, repo, appschema, source_config, *args, **kwargs): self.repo = repo self.uri = source_config['uri'] @@ -177,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)