equal
deleted
inserted
replaced
77 uri = None |
77 uri = None |
78 # a reference to the system information helper |
78 # a reference to the system information helper |
79 repo = None |
79 repo = None |
80 # a reference to the instance'schema (may differs from the source'schema) |
80 # a reference to the instance'schema (may differs from the source'schema) |
81 schema = None |
81 schema = None |
|
82 |
|
83 # multi-sources planning control |
|
84 dont_cross_relations = () |
|
85 cross_relations = () |
|
86 |
82 |
87 |
83 def __init__(self, repo, appschema, source_config, *args, **kwargs): |
88 def __init__(self, repo, appschema, source_config, *args, **kwargs): |
84 self.repo = repo |
89 self.repo = repo |
85 self.uri = source_config['uri'] |
90 self.uri = source_config['uri'] |
86 set_log_methods(self, getLogger('cubicweb.sources.'+self.uri)) |
91 set_log_methods(self, getLogger('cubicweb.sources.'+self.uri)) |
174 else: |
179 else: |
175 return False |
180 return False |
176 if write: |
181 if write: |
177 return wsupport |
182 return wsupport |
178 return True |
183 return True |
|
184 |
|
185 def may_cross_relation(self, rtype): |
|
186 """return True if the relation may be crossed among sources. Rules are: |
|
187 |
|
188 * if this source support the relation, can't be crossed unless explicitly |
|
189 specified in .cross_relations |
|
190 |
|
191 * if this source doesn't support the relation, can be crossed unless |
|
192 explicitly specified in .dont_cross_relations |
|
193 """ |
|
194 if self.support_relation(rtype): |
|
195 return rtype in self.cross_relations |
|
196 return rtype not in self.dont_cross_relations |
179 |
197 |
180 def eid2extid(self, eid, session=None): |
198 def eid2extid(self, eid, session=None): |
181 return self.repo.eid2extid(self, eid, session) |
199 return self.repo.eid2extid(self, eid, session) |
182 |
200 |
183 def extid2eid(self, value, etype, session=None, **kwargs): |
201 def extid2eid(self, value, etype, session=None, **kwargs): |