http://www.mediawiki.org/wiki/Special:Code/pywikipedia/11255
Revision: 11255 Author: xqt Date: 2013-03-24 17:28:53 +0000 (Sun, 24 Mar 2013) Log Message: ----------- * use default user from config file for _sites cache (update from rewrite r5088), follow up for r11247, r11070 * remove old deprecate_arg warning for "persistent_http" (> 1 year)
Modified Paths: -------------- trunk/pywikipedia/wikipedia.py
Modified: trunk/pywikipedia/wikipedia.py =================================================================== --- trunk/pywikipedia/wikipedia.py 2013-03-24 17:19:45 UTC (rev 11254) +++ trunk/pywikipedia/wikipedia.py 2013-03-24 17:28:53 UTC (rev 11255) @@ -8715,20 +8715,26 @@ _sites = {} _namespaceCache = {}
-@deprecate_arg("persistent_http", None) + def getSite(code=None, fam=None, user=None, noLogin=False): if code is None: code = default_code if fam is None: fam = default_family + if user is None: + try: + user = config.usernames[fam][code] + except KeyError: + user = None key = '%s:%s:%s' % (fam, code, user) - if key not in _sites: + if not key in _sites: _sites[key] = Site(code=code, fam=fam, user=user) ret = _sites[key] if not ret.family.isPublic(code) and not noLogin: ret.forceLogin() return ret
+ def setSite(site): global default_code, default_family default_code = site.language()