John Vandenberg has uploaded a new change for review.
https://gerrit.wikimedia.org/r/167571
Change subject: Use sensible default for config.mylang
......................................................................
Use sensible default for config.mylang
If the user has not altered user-config.mylang, it is set to
'language' and pywikibot.Site() raises a confusing exception:
UnknownSite: Language language does not exist in family wikipedia
Detect this situation, report a warning, and set the default to
family 'test' and mylang 'test, which is test.wikipedia.org.
Change-Id: I3b890039381c7f8d06dfe6c0d83140ec5f2f3ed6
---
M pywikibot/config2.py
1 file changed, 7 insertions(+), 0 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core
refs/changes/71/167571/1
diff --git a/pywikibot/config2.py b/pywikibot/config2.py
index 4e01416..55453dc 100644
--- a/pywikibot/config2.py
+++ b/pywikibot/config2.py
@@ -50,6 +50,8 @@
family = 'wikipedia'
# The language code of the site we're working on.
mylang = 'language'
+# If family and mylang are not modified from the above, the default is changed
+# to test:test, which is test.wikipedia.org, at the end of this module.
# The dictionary usernames should contain a username for each site where you
# have a bot account. Please set your usernames by adding such lines to your
@@ -831,6 +833,11 @@
elif transliteration_target in ('None', 'none'):
transliteration_target = None
+# Fix up default site
+if family == 'wikipedia' and mylang == 'language':
+ print("WARNING: family and mylang are not set.\n"
+ "Defaulting to family='test' and mylang='test'.")
+ family = mylang = 'test'
#
# When called as main program, list all configuration variables
--
To view, visit https://gerrit.wikimedia.org/r/167571
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I3b890039381c7f8d06dfe6c0d83140ec5f2f3ed6
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: John Vandenberg <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits