Easy and small fixes for newest web2py. This is generated with 'git format-patch -1' command.
From: ont.rif <ont....@gmail.com> Date: Fri, 9 Apr 2010 20:28:03 +0700 Subject: [PATCH] (f) fix code to work with python 2.4 --- tools.py | 12 ++++++++++-- 1 files changed, 10 insertions(+), 2 deletions(-) diff --git a/tools.py b/tools.py index cc6f656..9b3d197 100644 --- a/tools.py +++ b/tools.py @@ -2525,7 +2525,10 @@ urllib2.install_opener(urllib2.build_opener(urllib2.HTTPCookieProcessor())) def fetch(url, data=None, headers={}, cookie=Cookie.SimpleCookie(), user_agent='Mozilla/5.0'): - data = data if data is None else urllib.urlencode(data) + + if data is not None: + data = urllib.urlencode(data) + if user_agent: headers['User-agent'] = user_agent headers['Cookie'] = ' '.join(['%s=%s;'%(c.key,c.value) for c in cookie.values()]) try: @@ -2534,7 +2537,12 @@ def fetch(url, data=None, headers={}, req = urllib2.Request(url, data, headers) html = urllib2.urlopen(req).read() else: - method = urlfetch.GET if data is None else urlfetch.POST + + if data is None: + method = urlfetch.GET + else: + method = urlfetch.POST + while url is not None: response = urlfetch.fetch(url=url, payload=data, method=method, headers=headers, -- 1.5.5.6 -- To unsubscribe, reply using "remove me" as the subject.