From 560f2e75163c9e52f4a44e891daeeea611081fa8 Mon Sep 17 00:00:00 2001 From: nasonfish Date: Mon, 28 Jan 2013 00:09:59 -0700 Subject: [PATCH] cleanup, don't raise the error if you catch it --- plugins/snowy-evening.py | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/plugins/snowy-evening.py b/plugins/snowy-evening.py index a3c1e7a..37787f3 100644 --- a/plugins/snowy-evening.py +++ b/plugins/snowy-evening.py @@ -13,21 +13,15 @@ def stripStrongTags(text): @hook.regex(*snowy_re) def snowy(match, nick="", reply=""): try: - - owner, name, id, nothing = match.group(1).split("/") + owner, name, id, blankSpace = match.group(1).split("/") soup = http.get_soup("https://snowy-evening.com/%s/%s/%s" % (owner, name, id)) - header = ''.join([unicode(tag) for tag in (soup.h2)]) - header = header.replace("Issue Details", "").replace("#%s " % id, "") - info = soup.find_all('p', text=True)[0] - info = ''.join([unicode(tag) for tag in info]) + header = ''.join([unicode(tag) for tag in (soup.h2)]).replace("Issue Details", "").replace("#%s " % id, "") + info = ''.join([unicode(tag) for tag in soup.p]) if info.isspace(): info = "No details found" - reply("Project %s by %s: Issue #%s: %s - %s" % (name, owner, id, header, text.truncate_str(info, 150))) stats = soup.find_all('ul', {'id':'stats'}, text=True) - priority, number, type, status, age, other = soup.find_all('strong', text=True) - data = { "priority" : stripStrongTags(''.join(priority)), "number" : stripStrongTags(''.join(number)), @@ -37,5 +31,4 @@ def snowy(match, nick="", reply=""): } reply("This issue has a priority of \x02{priority}\x02. It's age is \x02{age}\x02 and it is a \x02{type}\x02. It's status is \x02{status}\x02.".format(**data)) except Exception: - reply("An error occured while trying to retrieve the data.") - raise \ No newline at end of file + reply("An error occured while trying to retrieve the data.") \ No newline at end of file