Weather: more verbose zmw codes in ambig. results

when printing zmw codes because the query was ambiguous, print
city, country rather than just city
This commit is contained in:
Brian S. Stephan 2012-10-05 10:30:03 -05:00
parent 49e83f18de
commit 0da81ca31e
1 changed files with 4 additions and 2 deletions

View File

@ -122,9 +122,11 @@ class Weather(Module):
reply = "Multiple results, try one of the following zmw codes:"
for res in results[:-1]:
q = res['l'].strip('/q/')
reply += " {0:s} ({1:s}),".format(q, res['name'])
reply += " {0:s} ({1:s}, {2:s}),".format(q, res['name'],
res['country_name'])
q = results[-1]['l'].strip('/q/')
reply += " or {0:s} ({1:s}).".format(q, results[-1]['name'])
reply += " or {0:s} ({1:s}, {2:s}).".format(q, results[-1]['name'],
results[-1]['country_name'])
return reply
except KeyError as e:
# now we really know something is wrong