http://www.mediawiki.org/wiki/Special:Code/pywikipedia/10711
Revision: 10711 Author: xqt Date: 2012-11-11 19:57:35 +0000 (Sun, 11 Nov 2012) Log Message: ----------- follow up for r10440 fix for bug #3579749
Modified Paths: -------------- trunk/pywikipedia/pywikibot/comms/http.py
Modified: trunk/pywikipedia/pywikibot/comms/http.py =================================================================== --- trunk/pywikipedia/pywikibot/comms/http.py 2012-11-11 18:24:24 UTC (rev 10710) +++ trunk/pywikipedia/pywikibot/comms/http.py 2012-11-11 19:57:35 UTC (rev 10711) @@ -24,22 +24,23 @@ from pywikibot import * import wikipedia as pywikibot
- # global variables - # import useragent and MyURLopener from global namespace useragent = pywikibot.useragent MyURLopener = pywikibot.MyURLopener
+ class buffered_addinfourl(object): """ Buffered transparent addinfourl wrapper to enable re-reading of all attributes. """ + def __init__(self, addinfourl): self._parent = addinfourl self._buffer = {} - def __getattr__(self, name): + + def __getattr__(self, name, *args, **kwds): # raise same exception as parent if attribute does not exist attr = getattr(self._parent, name) if callable(attr): @@ -48,6 +49,7 @@ else: # do call to buffer data from parent and return return self._call(name, attr, *args, **kwds) + def _call(self, name, attr, *args, **kwds): if name not in self._buffer: # buffer data from parent @@ -55,6 +57,7 @@ # return buffered data return self._buffer[name]
+ def request(site, uri, retry = None, sysop = False, data = None, compress = True, no_hostname = False, cookie_only=False, refer=None, back_response=False): """