def _sorted_from_obj(self, data): # data is a list of the type generated by parse_qsl if isinstance(data, list): items = data else: # complex objects: try: # django.http.QueryDict, items = [(i[0], j) for i in data.lists() for j in i[1]] except AttributeError: # webob.multidict.MultiDict # werkzeug.datastructures.MultiDict items = iteritems(data) return sorted(items, key=lambda p: p[0])
def __str__(self): p = [";%s=%s" % (k, v) for k, v in iteritems(self.params)] return "%s%s" % (self.value, "".join(p))
def __init__(self, *args, **kwargs): d = dict(*args, **kwargs) for key, value in iteritems(d): dict.__setitem__(self, str(key).title(), value) dict.__init__(self)