# HG changeset patch # User Sylvain Thénault # Date 1371830024 -7200 # Node ID e2dfdd313dfe04f2bac8022afd4e759f258ea024 # Parent d5ed6efd644862d510ce99d105be6413c142b163 [multi-sources-removal] Drop foreid argument of repo.get_option_value It doesn't need it anymore. Related to #2919300 diff -r d5ed6efd6448 -r e2dfdd313dfe dbapi.py --- a/dbapi.py Fri Jun 21 16:17:17 2013 +0200 +++ b/dbapi.py Fri Jun 21 17:53:44 2013 +0200 @@ -288,7 +288,10 @@ self.set_default_language(vreg) def get_option_value(self, option, foreid=None): - return self.cnx.get_option_value(option, foreid) + if foreid is not None: + warn('[3.19] foreid argument is deprecated', DeprecationWarning, + stacklevel=2) + return self.cnx.get_option_value(option) def set_session(self, session): """method called by the session handler when the user is authenticated @@ -659,11 +662,14 @@ @check_not_closed def get_option_value(self, option, foreid=None): - """Return the value for `option` in the configuration. If `foreid` is - specified, the actual repository to which this entity belongs is - dereferenced and the option value retrieved from it. + """Return the value for `option` in the configuration. + + `foreid` argument is deprecated and now useless (as of 3.19). """ - return self._repo.get_option_value(option, foreid) + if foreid is not None: + warn('[3.19] foreid argument is deprecated', DeprecationWarning, + stacklevel=2) + return self._repo.get_option_value(option) @check_not_closed def describe(self, eid, asdict=False): diff -r d5ed6efd6448 -r e2dfdd313dfe repoapi.py --- a/repoapi.py Fri Jun 21 16:17:17 2013 +0200 +++ b/repoapi.py Fri Jun 21 17:53:44 2013 +0200 @@ -17,6 +17,7 @@ # with CubicWeb. If not, see . """Official API to access the content of a repository """ +from warnings import warn from logilab.common.deprecation import deprecated @@ -243,6 +244,9 @@ specified, the actual repository to which this entity belongs is dereferenced and the option value retrieved from it. """ + if foreid is not None: + warn('[3.19] foreid argument is deprecated', DeprecationWarning, + stacklevel=2) return self._session.repo.get_option_value(option, foreid) describe = _srv_cnx_func('describe') diff -r d5ed6efd6448 -r e2dfdd313dfe server/repository.py --- a/server/repository.py Fri Jun 21 16:17:17 2013 +0200 +++ b/server/repository.py Fri Jun 21 17:53:44 2013 +0200 @@ -543,31 +543,17 @@ return cubes def get_option_value(self, option, foreid=None): - """Return the value for `option` in the configuration. If `foreid` is - specified, the actual repository to which this entity belongs is - derefenced and the option value retrieved from it. + """Return the value for `option` in the configuration. This is a public method, not requiring a session id. + + `foreid` argument is deprecated and now useless (as of 3.19). """ + if foreid is not None: + warn('[3.19] foreid argument is deprecated', DeprecationWarning, + stacklevel=2) # XXX we may want to check we don't give sensible information - # XXX the only cube using 'foreid', apycot, stop used this, we probably - # want to drop this argument - if foreid is None: - return self.config[option] - _, sourceuri, extid, _ = self.type_and_source_from_eid(foreid) - if sourceuri == 'system': - return self.config[option] - cnxset = self._get_cnxset() - try: - cnx = cnxset.connection(sourceuri) - # needed to check connection is valid and usable by the current - # thread - newcnx = self.sources_by_uri[sourceuri].check_connection(cnx) - if newcnx is not None: - cnx = newcnx - return cnx.get_option_value(option, extid) - finally: - self._free_cnxset(cnxset) + return self.config[option] @cached def get_versions(self, checkversions=False): diff -r d5ed6efd6448 -r e2dfdd313dfe server/session.py --- a/server/session.py Fri Jun 21 16:17:17 2013 +0200 +++ b/server/session.py Fri Jun 21 17:53:44 2013 +0200 @@ -1438,7 +1438,10 @@ @deprecated('[3.19] use a Connection object instead') def get_option_value(self, option, foreid=None): - return self.repo.get_option_value(option, foreid) + if foreid is not None: + warn('[3.19] foreid argument is deprecated', DeprecationWarning, + stacklevel=2) + return self.repo.get_option_value(option) @deprecated('[3.19] use a Connection object instead') def transaction(self, free_cnxset=True):