jenkins-bot has submitted this change and it was merged.
Change subject: [FIX] config: Don't crash on later get_base_dir calls
......................................................................
[FIX] config: Don't crash on later get_base_dir calls
All module variables starting with only one underscore get deleted after the
module's instantiation and with 2b07db2a the variable to store whether no user
config should be loaded was stored in such a variable and thus deleted so that
when `get_base_dir` was called afterwards it would crash because it is missing.
This patch renames the variable into using two underscores to still hide it's
presence but prevent it from deletion after the instantiation.
Conflicts:
pywikibot/config2.py
Change-Id: I538a73ff37da27a34ab732becafbf5a58b72a464
(cherry picked from commit c29a59f95803f517f0fb9a999b59db94b7085404)
---
M pywikibot/config2.py
1 file changed, 8 insertions(+), 8 deletions(-)
Approvals:
John Vandenberg: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/config2.py b/pywikibot/config2.py
index f9dcab8..f2d644f 100644
--- a/pywikibot/config2.py
+++ b/pywikibot/config2.py
@@ -60,9 +60,9 @@
# names and some magic variables (like __name__)
_imports = frozenset(name for name in globals() if not name.startswith('_'))
-_no_user_config = os.environ.get('PYWIKIBOT2_NO_USER_CONFIG')
-if _no_user_config == '0':
- _no_user_config = None
+__no_user_config = os.environ.get('PYWIKIBOT2_NO_USER_CONFIG')
+if __no_user_config == '0':
+ __no_user_config = None
class _ConfigurationDeprecationWarning(UserWarning):
@@ -297,8 +297,8 @@
# check if user-config.py is in base_dir
if not exists(base_dir):
exc_text = "No user-config.py found in directory '%s'.\n" % base_dir
- if _no_user_config:
- if _no_user_config != '2':
+ if __no_user_config:
+ if __no_user_config != '2':
print(exc_text)
else:
exc_text += " Please check that user-config.py is stored in the
correct location.\n"
@@ -905,8 +905,8 @@
# Get the user files
_thislevel = 0
-if _no_user_config:
- if _no_user_config != '2':
+if __no_user_config:
+ if __no_user_config != '2':
print("WARNING: Skipping loading of user-config.py.")
_fns = []
else:
@@ -1004,7 +1004,7 @@
# Fix up default site
-if family == 'wikipedia' and mylang == 'language' and _no_user_config != '2':
+if family == 'wikipedia' and mylang == 'language' and __no_user_config != '2':
print("WARNING: family and mylang are not set.\n"
"Defaulting to family='test' and mylang='test'.")
family = mylang = 'test'
--
To view, visit https://gerrit.wikimedia.org/r/246942
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I538a73ff37da27a34ab732becafbf5a58b72a464
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/core
Gerrit-Branch: 2.0
Gerrit-Owner: XZise <[email protected]>
Gerrit-Reviewer: John Vandenberg <[email protected]>
Gerrit-Reviewer: Ladsgroup <[email protected]>
Gerrit-Reviewer: XZise <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits