Commits

Kirill Morarenko  committed 79d1296

various improvements in cmdWeather

  • Participants
  • Parent commits be7947d

Comments (0)

Files changed (1)

File tests/test.py

             w = pywapi.get_weather_from_google(city, hl="ru")
             result = u"%s. %s" % (s1(w["current_conditions"]), u". ".join(s2(x) for x in w["forecasts"]))
         except:
-            result = chatify(u"\n" + unicode(traceback.format_exc(), "utf-8"))
-        return (u"%s: %s" % (unicode(city, "utf-8"), result)).encode("utf-8")
+            #result = chatify(u"\n" + unicode(traceback.format_exc(), "utf-8"))
+            result = u"не знаю такого города."
+        return (u"\"%s\": %s" % (unicode(city, "utf-8"), result)).encode("utf-8")
         
     parts = text.strip().split()
     if len(parts) == 1:
         city = "Москва"
     else:
-        city = parts[1].strip()
+        city = " ".join([x.strip() for x in parts[1:]])
     print "weather for %s (%s)" % (city, text)
     crg.sendMessage(avatar, channel, crg.Message(getWeather(city), msg.sender() if channel.isPrivate() else ""), onSent)