Revision: 7467
Author: alexsh
Date: 2009-10-14 19:33:36 +0000 (Wed, 14 Oct 2009)
Log Message:
-----------
GetData():handle ListToParam if values type is list()
Modified Paths:
--------------
trunk/pywikipedia/query.py
Modified: trunk/pywikipedia/query.py
===================================================================
--- trunk/pywikipedia/query.py 2009-10-14 18:01:00 UTC (rev 7466)
+++ trunk/pywikipedia/query.py 2009-10-14 19:33:36 UTC (rev 7467)
@@ -46,7 +46,9 @@
if wikipedia.verbose:
wikipedia.output("====API PARAMS====")
for k,v in params.iteritems():
- if not IsString(v):
+ if type(v) == list:
+ params[k] = unicode(ListToParam(v))
+ elif not IsString(v):
params[k] = unicode(v)
if wikipedia.verbose:
if type(v) not in (int, long):
@@ -64,7 +66,7 @@
wikipedia.output("==================")
- if 'format' not in params:
+ if 'format' not in params or params['format'] != 'json':
params['format'] = 'json'
if not useAPI:
@@ -135,10 +137,13 @@
# This will also work, but all unicode strings will need to be
converted from \u notation
# decodedObj = eval( jsontext )
+
+ jsontext = json.loads( jsontext )
+
if back_response:
- return res, json.loads( jsontext )
+ return res, jsontext
else:
- return json.loads( jsontext )
+ return jsontext
except ValueError, error:
if "<title>Wiki does not exist</title>" in jsontext:
_______________________________________________
Pywikipedia-svn mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikipedia-svn