From 61c2f3e65c8ec4c59fc3890c352b51b10947bbb4 Mon Sep 17 00:00:00 2001 From: Ryan Hitchman Date: Thu, 4 Mar 2010 22:15:29 -0700 Subject: [PATCH] oops --- core/main.py | 2 +- plugins/drama.py | 10 +++++----- plugins/log.py | 3 ++- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/core/main.py b/core/main.py index b00282f..27b3cab 100644 --- a/core/main.py +++ b/core/main.py @@ -27,7 +27,7 @@ class Input(dict): def __getattr__(self, key): return self[key] - def __setattr__(self, key value): + def __setattr__(self, key, value): self[key] = value diff --git a/plugins/drama.py b/plugins/drama.py index bffa7bd..446ee77 100755 --- a/plugins/drama.py +++ b/plugins/drama.py @@ -1,4 +1,4 @@ -'''Searches Encyclopedia Dramatica and returns the first paragraph of the +'''Searches Encyclopedia Dramatica and returns the first paragraph of the article''' import json @@ -7,8 +7,8 @@ import urllib2 from util import hook -api_url = "http://encyclopediadramatica.com/api.php?action=opensearch&search=%s" -ed_url = "http://encyclopediadramatica.com/%s" +api_url = "http://encyclopediadramatica.com/api.php?action=opensearch&search=" +ed_url = "http://encyclopediadramatica.com/" ua_header = ('User-Agent','Skybot/1.0 http://bitbucket.org/Scaevolus/skybot/') @@ -21,7 +21,7 @@ def drama(inp): if not inp: return drama.__doc__ - q = api_url % (urllib2.quote(inp, safe='')) + q = api_url + (urllib2.quote(inp, safe='')) request = urllib2.Request(q) request.add_header(*ua_header) j = json.loads(urllib2.build_opener().open(request).read()) @@ -29,7 +29,7 @@ def drama(inp): return 'no results found' article_name = j[1][0].replace(' ', '_') - url = ed_url % (urllib2.quote(article_name)) + url = ed_url + (urllib2.quote(article_name)) request = urllib2.Request(url) request.add_header(*ua_header) page = html.fromstring(urllib2.build_opener().open(request).read()) diff --git a/plugins/log.py b/plugins/log.py index 2ade656..964c437 100644 --- a/plugins/log.py +++ b/plugins/log.py @@ -43,7 +43,8 @@ def gmtime(format): def beautify(input): format = formats.get(input.command, '%(raw)s') - args = vars(input) + args = dict(input) + leng = len(args['paraml']) for n, p in enumerate(args['paraml']): args['param' + str(n)] = p