use urllib to escape queries

This commit is contained in:
Romain Bignon 2010-12-06 13:18:55 +01:00
commit be359ba655
2 changed files with 6 additions and 5 deletions

View file

@ -41,10 +41,10 @@ class MeteofranceBackend(BaseBackend, ICapWeather):
return self.create_browser()
def get_current(self, city_id):
return self.browser.get_current(city_id.split("@")[0])
return self.browser.get_current(city_id)
def iter_forecast(self, city_id):
return self.browser.iter_forecast(city_id.split("@")[0])
return self.browser.iter_forecast(city_id)
def iter_city_search(self, pattern):
return self.browser.iter_city_search(pattern.replace(' ','+'))
return self.browser.iter_city_search(pattern)

View file

@ -16,9 +16,10 @@
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
import urllib
from weboob.tools.browser import BaseBrowser
#from .pages.index import
from .pages.meteo import WeatherPage, CityPage
@ -42,7 +43,7 @@ class MeteofranceBrowser(BaseBrowser):
BaseBrowser.__init__(self, *args, **kwargs)
def iter_city_search(self, pattern):
searchurl = self.CITY_SEARCH_URL.format( city_pattern=pattern )
searchurl = self.CITY_SEARCH_URL.format(city_pattern=urllib.quote_plus(pattern))
self.location(searchurl)
if self.is_on_page(CityPage):