time.py now handles unknown locations correctly

This commit is contained in:
Luke Rogers 2012-05-01 00:41:20 +12:00
parent 5468d80b69
commit a018763cb7

View file

@ -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