XZise has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/216932

Change subject: [FIX] version: Use attribute instead of key
......................................................................

[FIX] version: Use attribute instead of key

The version script prints the `__version__` attribute of requests but if the
import fails it's creating a dict which doesn't have such an attribute.

Change-Id: I9bae580e457f48daeab35fbb6941dd6928d06f28
---
M scripts/version.py
1 file changed, 7 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/32/216932/1

diff --git a/scripts/version.py b/scripts/version.py
index 3debf0b..7a90fd8 100755
--- a/scripts/version.py
+++ b/scripts/version.py
@@ -21,7 +21,13 @@
 try:
     import requests
 except ImportError:
-    requests = {'__version__': 'n/a'}
+    class DummyRequests(object):
+
+        """Fake requests instance."""
+
+        __version__ = 'n/a'
+
+    requests = DummyRequests()
 
 WMF_CACERT = 'MIIDxTCCAq2gAwIBAgIQAqxcJmoLQJuPC3nyrkYldzANBgkqhkiG9w0BAQUFADBs'
 

-- 
To view, visit https://gerrit.wikimedia.org/r/216932
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9bae580e457f48daeab35fbb6941dd6928d06f28
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: XZise <commodorefabia...@gmx.de>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to