~davidc3/ubuntu-rest-scopes/testing-newyorktimes

« back to all changes in this revision

Viewing changes to src/scopes/__init__.py

  • Committer: David Callé
  • Date: 2014-02-16 00:27:18 UTC
  • mfrom: (3.1.27 ubuntu-rest-scopes)
  • Revision ID: davidc@framli.eu-20140216002718-9j3bcst2k28bp1qq
Merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
86
86
    def _get_search_args(self, environ):
87
87
        """Get the parameters for the 'search', checking all is ok."""
88
88
        # get the query string, decode, build the query dictionary
89
 
        qs = environ.get("QUERY_STRING", "").decode("utf8")
90
 
        qd = dict(urlparse.parse_qsl(qs))
 
89
        qs = environ.get("QUERY_STRING", "")
 
90
        qd = dict(urlparse.parse_qsl(qs, keep_blank_values=True))
91
91
 
92
92
        # latitude and longitude must be paired
93
93
        lat = float(qd['latitude']) if 'latitude' in qd else None
108
108
 
109
109
        # get all the rest of parameters, checking also type
110
110
        args = {
111
 
            'query': qd['q'],
 
111
            'query': qd['q'].decode('utf8'),
112
112
            'session_id': qd.get('session_id'),
113
113
            'query_id': int(qd['query_id']) if 'query_id' in qd else None,
114
114
            'locale': locale,