server/repository.py
changeset 9458 e2dfdd313dfe
parent 9456 a79e88aad555
child 9460 a2a0bc984863
equal deleted inserted replaced
9457:d5ed6efd6448 9458:e2dfdd313dfe
   541         cubes = list(versions)
   541         cubes = list(versions)
   542         cubes.remove('cubicweb')
   542         cubes.remove('cubicweb')
   543         return cubes
   543         return cubes
   544 
   544 
   545     def get_option_value(self, option, foreid=None):
   545     def get_option_value(self, option, foreid=None):
   546         """Return the value for `option` in the configuration. If `foreid` is
   546         """Return the value for `option` in the configuration.
   547         specified, the actual repository to which this entity belongs is
       
   548         derefenced and the option value retrieved from it.
       
   549 
   547 
   550         This is a public method, not requiring a session id.
   548         This is a public method, not requiring a session id.
   551         """
   549 
       
   550         `foreid` argument is deprecated and now useless (as of 3.19).
       
   551         """
       
   552         if foreid is not None:
       
   553             warn('[3.19] foreid argument is deprecated', DeprecationWarning,
       
   554                  stacklevel=2)
   552         # XXX we may want to check we don't give sensible information
   555         # XXX we may want to check we don't give sensible information
   553         # XXX the only cube using 'foreid', apycot, stop used this, we probably
   556         return self.config[option]
   554         # want to drop this argument
       
   555         if foreid is None:
       
   556             return self.config[option]
       
   557         _, sourceuri, extid, _ = self.type_and_source_from_eid(foreid)
       
   558         if sourceuri == 'system':
       
   559             return self.config[option]
       
   560         cnxset = self._get_cnxset()
       
   561         try:
       
   562             cnx = cnxset.connection(sourceuri)
       
   563             # needed to check connection is valid and usable by the current
       
   564             # thread
       
   565             newcnx = self.sources_by_uri[sourceuri].check_connection(cnx)
       
   566             if newcnx is not None:
       
   567                 cnx = newcnx
       
   568             return cnx.get_option_value(option, extid)
       
   569         finally:
       
   570             self._free_cnxset(cnxset)
       
   571 
   557 
   572     @cached
   558     @cached
   573     def get_versions(self, checkversions=False):
   559     def get_versions(self, checkversions=False):
   574         """Return the a dictionary containing cubes used by this instance
   560         """Return the a dictionary containing cubes used by this instance
   575         as key with their version as value, including cubicweb version.
   561         as key with their version as value, including cubicweb version.