def query_string(self): """ The map request as a query string (the order is not guaranteed). >>> qs = RequestParams(dict(foo='egg', bar='ham%eggs', baz=100)).query_string >>> sorted(qs.split('&')) ['bar=ham%25eggs', 'baz=100', 'foo=egg'] """ kv_pairs = [] for key, values in self.params.iteritems(): value = ','.join(text_type(v) for v in values) kv_pairs.append(key + '=' + quote(value.encode('utf-8'), safe=',')) return '&'.join(kv_pairs)
def base_url(self): return (self.host_url.rstrip('/') + quote(self.environ.get('SCRIPT_NAME', '').rstrip('/')) + quote(self.environ.get('PATH_INFO', ''))
def script_url(self): "Full script URL without trailing /" return (self.host_url.rstrip('/') + quote(self.environ.get('SCRIPT_NAME', '/').rstrip('/')) )