saper has uploaded a new change for review.

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


Change subject: Use % substitution instead of str.format
......................................................................

Use % substitution instead of str.format

Python 2.5 does not have str.format() and
it is not strictly necessary here.

Change-Id: If23c8d2a42947381d25d26fced3437cbe35a900f
---
M wikipedia.py
1 file changed, 3 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/compat 
refs/changes/95/98395/1

diff --git a/wikipedia.py b/wikipedia.py
index d0d8488..6d30811 100644
--- a/wikipedia.py
+++ b/wikipedia.py
@@ -185,7 +185,7 @@
 
 
 # Format string for the default user agent.
-USER_AGENT_FORMAT = '{script}/r{version[rev]} Pywikipediabot/1.0'
+USER_AGENT_FORMAT = '%(script)s/r%(versionrev)s Pywikipediabot/1.0'
 
 SaxError = xml.sax._exceptions.SAXParseException
 
@@ -5982,9 +5982,9 @@
     useragent = s
 
 # Default User-agent
-setUserAgent(USER_AGENT_FORMAT.format(
+setUserAgent(USER_AGENT_FORMAT % dict(
     script=('-'.join(version.get_executing_script())),
-    version=version.getversiondict()
+    versionrev=(version.getversiondict()["rev"])
 ))
 
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: If23c8d2a42947381d25d26fced3437cbe35a900f
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/compat
Gerrit-Branch: master
Gerrit-Owner: saper <sa...@saper.info>

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

Reply via email to