Merge lp:~keegan-csmith/ibid/weatherbug-641313 into lp:~ibid-core/ibid/old-trunk-1.6

Proposed by Keegan Carruthers-Smith
Status: Merged
Approved by: Stefano Rivera
Approved revision: 964
Merged at revision: 963
Proposed branch: lp:~keegan-csmith/ibid/weatherbug-641313
Merge into: lp:~ibid-core/ibid/old-trunk-1.6
Diff against target: 27 lines (+7/-2)
1 file modified
ibid/plugins/geography.py (+7/-2)
To merge this branch: bzr merge lp:~keegan-csmith/ibid/weatherbug-641313
Reviewer Review Type Date Requested Status
Max Rabkin Approve
Stefano Rivera Approve
Review via email: mp+36664@code.launchpad.net

Commit message

Add "weather forecast for" syntax to weather

Description of the change

To post a comment you must log in.
Revision history for this message
Stefano Rivera (stefanor) wrote :

Query: weather forecast for cape town
Response: City not found
Response: Sunday: Overcast. High: 16° C., Sunday Night: Chance of Rain. Low: 7° C., Monday: Clear. High: 17° C., Monday Night: Clear. Low: 5° C., Tuesday: Clear. High: 22° C., Tuesday Night: Clear. Low: 9° C., Wednesday: Scattered Clouds. High: 23° C., Wednesday Night: Clear. Low: 11° C., Thursday: Clear. High: 22° C., Thursday Night: Partly Cloudy. Low: 10° C., Friday: Partly Cloudy. High: 21° C., Friday Night: Chance of Rain. Low: 8° C., Saturday: Chance of Rain. High: 18° C., Saturday Night: Chance of Rain. Low: 9° C.

^ That doesn't seem right. They are both catching it.

review: Needs Fixing
964. By Keegan Carruthers-Smith

Ignore "weather forecast..." in weather method.

Revision history for this message
Stefano Rivera (stefanor) :
review: Approve
Revision history for this message
Max Rabkin (max-rabkin) wrote :

"Weather for Forecast, Alabama" doesn't work (though I just made up the place). There probably aren't that many places (if any) whose names start with "forecast", so I'm not going to vote on this.

Revision history for this message
Max Rabkin (max-rabkin) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ibid/plugins/geography.py'
2--- ibid/plugins/geography.py 2010-06-29 16:31:20 +0000
3+++ ibid/plugins/geography.py 2010-09-26 20:45:55 +0000
4@@ -189,8 +189,13 @@
5
6 return forecasts
7
8- @match(r'^weather\s+(?:(?:for|at|in)\s+)?(.+)$')
9+ @match(r'^weather (?:(?:for|at|in) )?(.+)$')
10 def weather(self, event, place):
11+ # The regex also matches "weather forecast..." which forecast should
12+ # process. So ignore it when this happens
13+ if place.lower().startswith('forecast'):
14+ return
15+
16 try:
17 values = self.remote_weather(place)
18 event.addresponse(u'In %(place)s at %(time)s: %(temp)s; Humidity: %(humidity)s; Wind: %(wind)s; Conditions: %(conditions)s; Sunrise/set: %(sunrise)s/%(sunset)s; Moonrise/set: %(moonrise)s/%(moonset)s', values)
19@@ -202,7 +207,7 @@
20 except Weather.WeatherException, e:
21 event.addresponse(unicode(e))
22
23- @match(r'^forecast\s+(?:for\s+)?(.+)$')
24+ @match(r'^(?:weather )forecast (?:for )?(.+)$')
25 def forecast(self, event, place):
26 try:
27 event.addresponse(u', '.join(self.remote_forecast(place)))

Subscribers

People subscribed via source and target branches