server/sources/__init__.py
changeset 9452 5308b3fe03c9
parent 9451 c83a8ecb9bf5
child 9463 d62e13eba033
equal deleted inserted replaced
9451:c83a8ecb9bf5 9452:5308b3fe03c9
    82     uri = None
    82     uri = None
    83     # a reference to the system information helper
    83     # a reference to the system information helper
    84     repo = None
    84     repo = None
    85     # a reference to the instance'schema (may differs from the source'schema)
    85     # a reference to the instance'schema (may differs from the source'schema)
    86     schema = None
    86     schema = None
    87 
       
    88     # multi-sources planning control
       
    89     dont_cross_relations = ()
       
    90     cross_relations = ()
       
    91 
    87 
    92     # force deactivation (configuration error for instance)
    88     # force deactivation (configuration error for instance)
    93     disabled = False
    89     disabled = False
    94 
    90 
    95     # boolean telling if cwuri of entities from this source is the url that
    91     # boolean telling if cwuri of entities from this source is the url that
   308                 return False
   304                 return False
   309         if write:
   305         if write:
   310             return wsupport
   306             return wsupport
   311         return True
   307         return True
   312 
   308 
   313     def may_cross_relation(self, rtype):
       
   314         """return True if the relation may be crossed among sources. Rules are:
       
   315 
       
   316         * if this source support the relation, can't be crossed unless explicitly
       
   317           specified in .cross_relations
       
   318 
       
   319         * if this source doesn't support the relation, can be crossed unless
       
   320           explicitly specified in .dont_cross_relations
       
   321         """
       
   322         # XXX find a way to have relation such as state_of in dont cross
       
   323         #     relation (eg composite relation without both end type available?
       
   324         #     card 1 relation ? ...)
       
   325         if self.support_relation(rtype):
       
   326             return rtype in self.cross_relations
       
   327         return rtype not in self.dont_cross_relations
       
   328 
       
   329     def before_entity_insertion(self, session, lid, etype, eid, sourceparams):
   309     def before_entity_insertion(self, session, lid, etype, eid, sourceparams):
   330         """called by the repository when an eid has been attributed for an
   310         """called by the repository when an eid has been attributed for an
   331         entity stored here but the entity has not been inserted in the system
   311         entity stored here but the entity has not been inserted in the system
   332         table yet.
   312         table yet.
   333 
   313