mst / whatsupcoming

2 stars 0 forks source link

Location names with umlauts not saveable #11

Closed mst closed 12 years ago

mst commented 12 years ago
---> 43             location, created = Location.objects.get_or_create(name=loc_name, city=loc_city)
     44 
     45             event.location = location

/Library/Python/2.7/site-packages/django/db/models/manager.pyc in get_or_create(self, **kwargs)
    132 
    133     def get_or_create(self, **kwargs):
--> 134         return self.get_query_set().get_or_create(**kwargs)
    135 
    136     def create(self, **kwargs):

/Library/Python/2.7/site-packages/django/db/models/query.pyc in get_or_create(self, **kwargs)
    447                 obj = self.model(**params)
    448                 sid = transaction.savepoint(using=self.db)
--> 449                 obj.save(force_insert=True, using=self.db)
    450                 transaction.savepoint_commit(sid, using=self.db)
    451                 return obj, True

/Users/marcelsteinbach/Projects/whatsupcoming/eventsearch/models.pyc in save(self, *args, **kwargs)
     16         query_result = GooglePlaces(YOUR_API_KEY).query(
     17         location=self.city +', Germany', keyword=self.name,
---> 18         radius=20000)
     19         if query_result.has_attributions:
     20 

/Users/marcelsteinbach/Projects/whatsupcoming/external/python-google-places.git/googleplaces/__init__.pyc in query(self, location, lat_lng, keyword, radius, sensor, types)
    167         self._add_required_param_keys()
    168         url, places_response = _fetch_remote_json(
--> 169                 GooglePlaces.QUERY_API_URL, self._request_params)
    170         _validate_response(url, places_response)
    171         return GooglePlacesSearchResult(self, places_response)

/Users/marcelsteinbach/Projects/whatsupcoming/external/python-google-places.git/googleplaces/__init__.pyc in _fetch_remote_json(service_url, params, use_http_post)
     33     """Retrieves a JSON object from a URL."""
     34     if not use_http_post:
---> 35         encoded_data = urllib.urlencode(params)
     36         query_url = (service_url if service_url.endswith('?') else
     37                      '%s?' % service_url)

/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib.pyc in urlencode(query, doseq)
   1292         for k, v in query:
   1293             k = quote_plus(str(k))
-> 1294             v = quote_plus(str(v))
   1295             l.append(k + '=' + v)
   1296     else:

UnicodeEncodeError: 'ascii' codec can't encode character u'\xe4' in position 1: ordinal not in range(128)