Chris McDonough
2013-11-27 ca419fb59ccf2174a87aba5139a293b807e15df6
revert my reversion
2 files modified
36 ■■■■ changed files
CHANGES.txt 10 ●●●● patch | view | raw | blame | history
pyramid/url.py 26 ●●●● patch | view | raw | blame | history
CHANGES.txt
@@ -50,7 +50,7 @@
- The anchor argument to ``pyramid.request.Request.route_url`` and
  ``pyramid.request.Request.resource_url`` and their derivatives will now be
  escaped to ensure minimal conformance.  See
  escaped via URL quoting to ensure minimal conformance.  See
  https://github.com/Pylons/pyramid/pull/1183
- Allow sending of ``_query`` and ``_anchor`` options to
@@ -61,10 +61,10 @@
- You can now send a string as the ``_query`` argument to
  ``pyramid.request.Request.route_url`` and
  ``pyramid.request.Request.resource_url`` and their derivatives.  When a
  string is sent instead of a list or dictionary. it is not URL-encoded or
  quoted; the caller must perform this job before passing it in.  This is
  useful if you want to be able to use a different query string format than
  ``x-www-form-urlencoded``.  See https://github.com/Pylons/pyramid/pull/1183
  string is sent instead of a list or dictionary. it is URL-quoted however it
  does not need to be in ``k=v`` form.  This is useful if you want to be able
  to use a different query string format than ``x-www-form-urlencoded``.  See
  https://github.com/Pylons/pyramid/pull/1183
Bug Fixes
---------
pyramid/url.py
@@ -48,7 +48,7 @@
    if '_query' in kw:
        query = kw.pop('_query')
        if isinstance(query, string_types):
            qs = '?' + query
            qs = '?' + url_quote(query, QUERY_SAFE)
        elif query:
            qs = '?' + urlencode(query, doseq=True)
@@ -176,12 +176,13 @@
        This data structure will be turned into a query string per the
        documentation of :func:`pyramid.url.urlencode` function.  This will
        produce a query string in the ``x-www-form-urlencoded`` format.  A
        non-``x-www-form-urlencoded`` encoding may be used by passing a
        *string* value as ``_query`` in which case it will be used without
        quoting or encoding; it is left up to the caller to do both and if he
        does not, an invalid URL may be generated.  After the query data is
        turned into a query string, a leading ``?`` is prepended, and the
        resulting string is appended to the generated URL.
        non-``x-www-form-urlencoded`` query string may be used by passing a
        *string* value as ``_query`` in which case it will be URL-quoted
        (e.g. query="foo bar" will become "foo%20bar").  However, the result
        will not need to be in ``k=v`` form as required by
        ``x-www-form-urlencoded``.  After the query data is turned into a query
        string, a leading ``?`` is prepended, and the resulting string is
        appended to the generated URL.
        .. note::
@@ -369,10 +370,11 @@
        function.  This will produce a query string in the
        ``x-www-form-urlencoded`` encoding.  A non-``x-www-form-urlencoded``
        query string may be used by passing a *string* value as ``query`` in
        which case it will be used without quoting or encoding; it is up to the
        caller to do both and if he does not an invalid URL may be generated.
        After the query data is turned into a query string, a leading ``?`` is
        prepended, and the resulting string is appended to the generated URL.
        which case it will be URL-quoted (e.g. query="foo bar" will become
        "foo%20bar").  However, the result will not need to be in ``k=v`` form
        as required by ``x-www-form-urlencoded``.  After the query data is
        turned into a query string, a leading ``?`` is prepended, and the
        resulting string is appended to the generated URL.
        .. note::
@@ -619,7 +621,7 @@
        if 'query' in kw:
            query = kw['query']
            if isinstance(query, string_types):
                qs = '?' + query
                qs = '?' + url_quote(query, QUERY_SAFE)
            elif query:
                qs = '?' + urlencode(query, doseq=True)