From a018763cb7cccb0c2419e6db5cddca6faed57587 Mon Sep 17 00:00:00 2001 From: Luke Rogers Date: Tue, 1 May 2012 00:41:20 +1200 Subject: [PATCH] time.py now handles unknown locations correctly --- plugins/time.py | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/plugins/time.py b/plugins/time.py index 41d9c31..9459733 100755 --- a/plugins/time.py +++ b/plugins/time.py @@ -22,19 +22,13 @@ def time_command(inp, bot=None): "text/text()")) time = time.replace(" | ", ", ") - # nice place name for UNIX time - if inp.lower() == "unix": - place = "Unix Epoch" - else: - place = capitalize_first(" ".join(request.xpath("//pod[@title='Input" \ - " interpretation']/subpod/plaintext/text()"))[16:]) - if time: - # if wolfram alpha had to guess a place, then show the place it chose - #if request.xpath("//assumptions"): - # return "%s - \x02%s\x02" % (time, place) - #else: - # return time + # nice place name for UNIX time + if inp.lower() == "unix": + place = "Unix Epoch" + else: + place = capitalize_first(" ".join(request.xpath("//pod[@" \ + "title='Input interpretation']/subpod/plaintext/text()"))[16:]) return "%s - \x02%s\x02" % (time, place) else: - return "Could not get the time for '%s'" % inp + return "Could not get the time for '%s'." % inp