jenkins-bot has submitted this change and it was merged.
Change subject: Fix support for site where lang != code ......................................................................
Fix support for site where lang != code
APISite.lang may change based on the siteinfo. For local files, the family 'lang' code should be used. e.g. This code may be 'wikidata' or 'commons'.
Change-Id: If71b3ab3e7ad14f873862954457b0cd7f0efb646 --- M scripts/watchlist.py M tests/script_tests.py 2 files changed, 5 insertions(+), 10 deletions(-)
Approvals: John Vandenberg: Looks good to me, but someone else must approve Ladsgroup: Looks good to me, approved jenkins-bot: Verified
diff --git a/scripts/watchlist.py b/scripts/watchlist.py index 34f8590..31236ad 100755 --- a/scripts/watchlist.py +++ b/scripts/watchlist.py @@ -45,7 +45,7 @@ else: fn = config.datafilepath('watchlists', 'watchlist-%s-%s.dat' - % (site.family.name, site.lang)) + % (site.family.name, site.code)) try: # find out how old our saved dump is (in seconds) file_age = time.time() - os.path.getmtime(fn) @@ -98,16 +98,11 @@ else: break
- if site.family.name == 'wikidata': - lang = 'wikidata' - else: - lang = site.lang - # Save the watchlist to disk # The file is stored in the watchlists subdir. Create if necessary. f = open(config.datafilepath('watchlists', 'watchlist-%s-%s%s.dat' - % (site.family.name, lang, + % (site.family.name, site.code, '-sysop' if sysop else '')), 'w') pickle.dump(watchlist, f) @@ -158,9 +153,10 @@ elif new: refresh_all(new, sysop=sysop) else: - refresh(pywikibot.Site(), sysop=sysop) + site = pywikibot.Site() + refresh(site, sysop=sysop)
- watchlist = get(pywikibot.Site()) + watchlist = get(site) pywikibot.output(u'%i pages in the watchlist.' % len(watchlist)) for pageName in watchlist: pywikibot.output(pageName, toStdout=True) diff --git a/tests/script_tests.py b/tests/script_tests.py index ef151ed..0651c63 100644 --- a/tests/script_tests.py +++ b/tests/script_tests.py @@ -55,7 +55,6 @@ and check_script_deps(name) and name != 'login.py' # this is moved to be first and name != 'imageuncat.py' # this halts indefinitely - and name != 'watchlist.py' # result depends on speed and name != 'welcome.py' # result depends on speed and name != 'script_wui.py' # depends on lua compiling ]