Пример #1
0
    def __str__(self):
        """
        Return string representation.

        :return: string representation of the KeyValueContainer instance.
        """
        return urlencode(self, encoding=self.encoding)
Пример #2
0
    def __str__(self):
        """
        Return string representation.

        :return: string representation of the DataContainer Object.
        """
        return urlencode(self, encoding=self.encoding)
Пример #3
0
    def __str__(self):
        """
        Return string representation.

        :return: string representation of the KeyValueContainer instance.
        """
        return urlencode(self, encoding=self.encoding)
Пример #4
0
    def __str__(self):
        """
        Return string representation.

        :return: string representation of the DataContainer Object.
        """
        return urlencode(self, encoding=self.encoding)
Пример #5
0
    def __str__(self):
        """
        >>> str(QueryString([('a','>'), ('b', ['a==1 && z >= 2','3>2'])]))
        'a=%3E&b=a%3D%3D1%20%26%26%20z%20%3E%3D%202&b=3%3E2'
        >>> str(QueryString([('a', 'x=/etc/passwd')]))
        'a=x%3D%2Fetc%2Fpasswd'

        :return: string representation of the QueryString object.
        """
        return enc_dec.urlencode(self, encoding=self.encoding, safe='')
Пример #6
0
    def __str__(self):
        """
        Return string representation.

        >>> str(DataContainer([(u'a','1'), (u'b', ['2','3'])]))
        'a=1&b=2&b=3'
        >>> str(DataContainer([(u'aaa', None)]))
        'aaa='
        >>> str(DataContainer([(u'aaa', '')]))
        'aaa='
        >>> str(DataContainer([(u'aaa', (None, ''))]))
        'aaa=&aaa='
        >>> import urllib
        >>> dc = DataContainer([(u'a','1'), (u'u', u'Ú-ú-Ü-ü')], 'latin1')
        >>> urllib.unquote(str(dc)).decode('latin-1') == u'a=1&u=Ú-ú-Ü-ü'
        True

        :return: string representation of the DataContainer Object.
        """
        return enc_dec.urlencode(self, encoding=self.encoding)
Пример #7
0
    def __str__(self):
        """
        Return string representation.

        >>> str(DataContainer([(u'a','1'), (u'b', ['2','3'])]))
        'a=1&b=2&b=3'
        >>> str(DataContainer([(u'aaa', None)]))
        'aaa='
        >>> str(DataContainer([(u'aaa', '')]))
        'aaa='
        >>> str(DataContainer([(u'aaa', (None, ''))]))
        'aaa=&aaa='
        >>> import urllib
        >>> dc = DataContainer([(u'a','1'), (u'u', u'Ú-ú-Ü-ü')], 'latin1')
        >>> urllib.unquote(str(dc)).decode('latin-1') == u'a=1&u=Ú-ú-Ü-ü'
        True

        :return: string representation of the DataContainer Object.
        """
        return enc_dec.urlencode(self, encoding=self.encoding)
Пример #8
0
    def __str__(self):
        """
        This method returns a string representation of the Form object.

        Please note that if the form has radio/select/checkboxes the
        first value will be put into the string representation and the
        others will be lost.

        :see: Unittest in test_form.py
        :return: string representation of the Form object.
        """
        d = dict()
        d.update(self.items())
        d.update(self.get_form_params().get_submit_map())

        for key in d:
            key_type = self.get_parameter_type(key, default=None)
            if key_type in self.AVOID_STR_DUPLICATES:
                d[key] = d[key][:1]

        return urlencode(d, encoding=self.encoding, safe='')
Пример #9
0
    def __str__(self):
        """
        This method returns a string representation of the Form object.

        Please note that if the form has radio/select/checkboxes the
        first value will be put into the string representation and the
        others will be lost.

        :see: Unittest in test_form.py
        :return: string representation of the Form object.
        """
        d = dict()
        d.update(self.items())
        d.update(self.get_form_params().get_submit_map())

        for key in d:
            key_type = self.get_parameter_type(key, default=None)
            if key_type in self.AVOID_STR_DUPLICATES:
                d[key] = d[key][:1]

        return urlencode(d, encoding=self.encoding, safe="")
    def __str__(self):
        """
        This method returns a string representation of the Form object.

        Please note that if the form has radio/select/checkboxes the
        first value will be put into the string representation and the
        others will be lost.

        @see: Unittest in test_form.py
        :return: string representation of the Form object.
        """
        d = dict(self)
        d.update(self._submit_map)

        avoid_duplicates = (self.INPUT_TYPE_CHECKBOX, self.INPUT_TYPE_RADIO, self.INPUT_TYPE_SELECT)

        for key in d:
            key_type = self._types.get(key, None)
            if key_type in avoid_duplicates:
                d[key] = d[key][:1]

        return urlencode(d, encoding=self.encoding)
Пример #11
0
    def __str__(self):
        """
        This method returns a string representation of the Form object.

        Please note that if the form has radio/select/checkboxes the
        first value will be put into the string representation and the
        others will be lost.

        @see: Unittest in test_form.py
        :return: string representation of the Form object.
        """
        d = dict(self)
        d.update(self._submit_map)

        avoid_duplicates = (self.INPUT_TYPE_CHECKBOX, self.INPUT_TYPE_RADIO,
                            self.INPUT_TYPE_SELECT)

        for key in d:
            key_type = self._types.get(key, None)
            if key_type in avoid_duplicates:
                d[key] = d[key][:1]

        return urlencode(d, encoding=self.encoding)
Пример #12
0
 def __str__(self):
     """
     :return: string representation of the QueryString object.
     """
     return enc_dec.urlencode(self, encoding=self.encoding, safe="")
Пример #13
0
 def test_simple(self):
     self.assertEqual(urlencode(parse_qs(u'a=1&a=c'), 'latin1'), 'a=1&a=c')
Пример #14
0
 def test_tilde_case02(self):
     self.assertEqual(urlencode(parse_qs(u'a=á&a=2'), 'utf-8'), 'a=%C3%A1&a=2')
Пример #15
0
 def test_tilde_case01(self):
     self.assertEqual(urlencode(parse_qs(u'a=á&a=2'), 'latin1'), 'a=%E1&a=2')
Пример #16
0
 def test_tilde_case02(self):
     self.assertEqual(urlencode(parse_qs(u'a=á&a=2'), 'utf-8'),
                      'a=%C3%A1&a=2')
Пример #17
0
 def __str__(self):
     """
     :return: string representation of the QueryString object.
     """
     return enc_dec.urlencode(self, encoding=self.encoding, safe='')
Пример #18
0
 def test_tilde_case01(self):
     self.assertEqual(urlencode(parse_qs(u'a=á&a=2'), 'latin1'),
                      'a=%E1&a=2')
Пример #19
0
 def test_simple(self):
     self.assertEqual(urlencode(parse_qs(u'a=1&a=c'), 'latin1'), 'a=1&a=c')