# HG changeset patch # User Sylvain Thénault # Date 1251385322 -7200 # Node ID 782fa7566a2221fe7e7200f89e0269de8163a8a8 # Parent e4dc22040f5fd941efe17483d2f081c8cb981f9c [multi-sources] new may_cross_relation method on sources diff -r e4dc22040f5f -r 782fa7566a22 server/sources/__init__.py --- 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) diff -r e4dc22040f5f -r 782fa7566a22 server/sources/native.py --- a/server/sources/native.py Thu Aug 27 17:01:32 2009 +0200 +++ b/server/sources/native.py Thu Aug 27 17:02:02 2009 +0200 @@ -268,6 +268,9 @@ # can't claim not supporting a relation return True #not rtype == 'content_for' + def may_cross_relation(self, rtype): + return True + def authenticate(self, session, login, password): """return CWUser eid for the given login/password if this account is defined in this source, else raise `AuthenticationError`