Ladsgroup has uploaded a new change for review.

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

Change subject: using json.dumps() instead of base string
......................................................................

using json.dumps() instead of base string

Change-Id: Ie9f6083cc44e5efb091f4158614f41470054358d
---
M wikipedia.py
1 file changed, 5 insertions(+), 4 deletions(-)


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

diff --git a/wikipedia.py b/wikipedia.py
index 13ee2ab..4778c50 100644
--- a/wikipedia.py
+++ b/wikipedia.py
@@ -4734,13 +4734,12 @@
                         pass
                 else:
                     pass
-                value = "{\"entity-type\":\"item\",\"numeric-id\":%s}" % value
+                value = {"entity-type": "item", "numeric-id": value}
             else:
                 raise RuntimeError("Unknown property type: %s" % value)
-                value = "{\"entity-type\":\"item\",\"numeric-id\":%s}" % value
         elif data_type == "time":
-            value = 
"{\"time\":\"%s\",\"timezone\":0,\"before\":0,\"after\":0,\"precision\":11,\"calendarmodel\":\"http://www.wikidata.org/entity/Q1985727\"}";
 \
-                    % value
+            value = {"time": value, "timezone": 0, "before": 0, "after": 0, 
"precision": 11,
+                     "calendarmodel": 
"http://www.wikidata.org/entity/Q1985727"}
             # about calendarmodel see
             # https://bugzilla.wikimedia.org/show_bug.cgi?id=48965
         else:
@@ -4750,6 +4749,8 @@
         for claim in claims:
             if claim['m'][1] == propertyID:
                 theclaim = claim
+        if isinstance(value, dict):
+            value = json.dumps(value)
         if theclaim and override:
             params = {
                 'action': 'wbsetclaimvalue',

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie9f6083cc44e5efb091f4158614f41470054358d
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/compat
Gerrit-Branch: master
Gerrit-Owner: Ladsgroup <ladsgr...@gmail.com>

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

Reply via email to