From 08a4b741946ae4d55d864f7c527657ab46b8d83b Mon Sep 17 00:00:00 2001 From: Fredrik Tolf Date: Sun, 5 Aug 2012 18:08:15 +0200 Subject: [PATCH] Added a simple function for producing an optionally parametrized URL. --- wrw/proto.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/wrw/proto.py b/wrw/proto.py index 881f4e4..aed5c4e 100644 --- a/wrw/proto.py +++ b/wrw/proto.py @@ -156,3 +156,10 @@ def parstring(pars = {}, **augment): if buf != "": buf += "&" buf += urlq(key) + "=" + urlq(str(augment[key])) return buf + +def parurl(url, pars = {}, **augment): + qs = parstring(pars, **augment) + if qs != "": + return url + "?" + qs + else: + return url -- 2.11.0