def __init__(self, query_string, mutable=False):
     MultiValueDict.__init__(self)
     self._mutable = True
     for key, value in parse_qsl((query_string or ''),
                                 True):  # keep_blank_values=True
         self.appendlist(key, value)
     self._mutable = mutable
Пример #2
0
    def __init__(self, data, mutable=False, encoding=None):
        MultiValueDict.__init__(self)
        if not encoding:
            # *Important*: do not import settings any earlier because of note
            # in core.handlers.modpython.
            from django.conf import settings
            encoding = settings.DEFAULT_CHARSET
        self.encoding = encoding

        if isinstance(data, dict):
            for key, value in data.items():
                if isinstance(value, (list, set)):
                    self.setlistdefault(key, [])
                    items = [NestedQueryDict(item) for item in value]
                    super(MultiValueDict, self).__setitem__(key, items)
                elif isinstance(value, dict):
                    self.appendlist(
                        force_unicode(key, encoding, errors='replace'),
                        NestedQueryDict(value))
                else:
                    self.appendlist(
                        force_unicode(key, encoding, errors='replace'),
                        force_unicode(value, encoding, errors='replace'))

        self._mutable = mutable
Пример #3
0
 def __init__(self, query_string, mutable=False, encoding=None):
     MultiValueDict.__init__(self)
     if not encoding:
         encoding = settings.DEFAULT_CHARSET
     self.encoding = encoding
     for key, value in parse_qsl((query_string or ''), True): # keep_blank_values=True
         self.appendlist(force_unicode(key, encoding, errors='replace'),
                         force_unicode(value, encoding, errors='replace'))
     self._mutable = mutable
Пример #4
0
 def __init__(self, query_string, mutable=False, encoding=None):
     MultiValueDict.__init__(self)
     if not encoding:
         encoding = settings.DEFAULT_CHARSET
     self.encoding = encoding
     for key, value in parse_qsl((query_string or ''), True): # keep_blank_values=True
         self.appendlist(force_unicode(key, encoding, errors='replace'),
                         force_unicode(value, encoding, errors='replace'))
     self._mutable = mutable
Пример #5
0
 def __init__(self, query_string, mutable=False, encoding=None):
     MultiValueDict.__init__(self)
     if not encoding:
         # *Important*: do not import settings any earlier because of note
         # in core.handlers.modpython.
         from django.conf import settings
         encoding = settings.DEFAULT_CHARSET
     self.encoding = encoding
     for key, value in parse_qsl((query_string or ''), True): # keep_blank_values=True
         self.appendlist(force_unicode(key, encoding, errors='replace'),
                         force_unicode(value, encoding, errors='replace'))
     self._mutable = mutable
Пример #6
0
 def __init__(self, query_string, mutable=False, encoding=None):
     MultiValueDict.__init__(self)
     if not encoding:
         # *Important*: do not import settings any earlier because of note
         # in core.handlers.modpython.
         from django.conf import settings
         encoding = settings.DEFAULT_CHARSET
     self.encoding = encoding
     for key, value in parse_qsl((query_string or ''), True): # keep_blank_values=True
         self.appendlist(force_unicode(key, encoding, errors='replace'),
                         force_unicode(value, encoding, errors='replace'))
     self._mutable = mutable
Пример #7
0
    def __init__(self, data, mutable=False, encoding=None):
        MultiValueDict.__init__(self)
        if not encoding:
            # *Important*: do not import settings any earlier because of note
            # in core.handlers.modpython.
            from django.conf import settings
            encoding = settings.DEFAULT_CHARSET
        self.encoding = encoding

        if isinstance(data, dict):
            for key, value in data.items():
                if isinstance(value, (list, set)):
                    self.setlistdefault(key, [])
                    items = [NestedQueryDict(item) for item in value]
                    super(MultiValueDict, self).__setitem__(key, items)
                elif isinstance(value, dict):
                    self.appendlist(force_text(key, encoding, errors='replace'),
                                    NestedQueryDict(value))
                else:
                    self.appendlist(force_text(key, encoding, errors='replace'), 
                                    force_text(value, encoding, errors='replace'))

        self._mutable = mutable
Пример #8
0
 def __init__(self, values, mutable=False, encoding=None):
     """ mutable and encoding are ignored :( """
     MultiValueDict.__init__(self, values)
Пример #9
0
 def __init__(self, values, mutable=False, encoding=None):
     """ mutable and encoding are ignored :( """
     MultiValueDict.__init__(self, values)
Пример #10
0
 def __init__(self, query_string, mutable=False):
     MultiValueDict.__init__(self)
     self._mutable = True
     for key, value in parse_qsl((query_string or ''), True): # keep_blank_values=True
         self.appendlist(key, value)
     self._mutable = mutable
Пример #11
0
 def __init__(self, values):
     MultiValueDict.__init__(self, values)