[Pywikipedia-svn] SVN: [7327] trunk/pywikipedia/query.py

alexsh at svn.wikimedia.org alexsh at svn.wikimedia.org
Tue Sep 29 04:00:40 UTC 2009


Revision: 7327
Author:   alexsh
Date:     2009-09-29 04:00:40 +0000 (Tue, 29 Sep 2009)

Log Message:
-----------
change to Post method if params has 'titles' key

Modified Paths:
--------------
    trunk/pywikipedia/query.py

Modified: trunk/pywikipedia/query.py
===================================================================
--- trunk/pywikipedia/query.py	2009-09-29 03:59:54 UTC (rev 7326)
+++ trunk/pywikipedia/query.py	2009-09-29 04:00:40 UTC (rev 7327)
@@ -32,7 +32,7 @@
     if not hasattr(json, 'loads'):
         # 'json' can also be the name in for 
         # http://pypi.python.org/pypi/python-json
-        import simplejson as json
+        raise ImportError
 except ImportError:
     import simplejson as json
     
@@ -70,7 +70,7 @@
         'block', 'unblock', 'move', 'emailuser','import', 'userrights',
     ]
     if useAPI:
-        if params['action'] in postAC:
+        if params['action'] in postAC or data:
             path = site.api_address()
         else:
             path = site.api_address() + urllib.urlencode(params.items())
@@ -95,7 +95,7 @@
                 params["User-agent"] = useragent
                 res = urllib2.urlopen(urllib2.Request(site.protocol() + '://' + site.hostname() + address, site.urlEncode(params)))
                 jsontext = res.read()
-            elif params['action'] in postAC:
+            elif params['action'] in postAC or data:
                 res, jsontext = site.postForm(path, params, sysop, site.cookies(sysop = sysop) )
             else:
                 if back_response:





More information about the Pywikipedia-svn mailing list