Imagine you're at `/foo?a=1&b=2`. Then `changequery(a=3)` will return `/foo?a=3&b=2` -- the same URL but with the arguments you requested changed.
(query=None, **kw)
| 111 | |
| 112 | |
| 113 | def changequery(query=None, **kw): |
| 114 | """ |
| 115 | Imagine you're at `/foo?a=1&b=2`. Then `changequery(a=3)` will return |
| 116 | `/foo?a=3&b=2` -- the same URL but with the arguments you requested |
| 117 | changed. |
| 118 | """ |
| 119 | if query is None: |
| 120 | query = web.rawinput(method="get") |
| 121 | for k, v in iteritems(kw): |
| 122 | if v is None: |
| 123 | query.pop(k, None) |
| 124 | else: |
| 125 | query[k] = v |
| 126 | out = web.ctx.path |
| 127 | if query: |
| 128 | out += "?" + urlencode(query, doseq=True) |
| 129 | return out |
| 130 | |
| 131 | |
| 132 | def url(path=None, doseq=False, **kw): |