From 11c9628ee0bad3e74e60b040986edc59465f4675 Mon Sep 17 00:00:00 2001 From: Fredrik Tolf Date: Wed, 18 Sep 2013 06:41:38 +0200 Subject: [PATCH] Converted URL quoting to Python3. --- wrw/proto.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/wrw/proto.py b/wrw/proto.py index 0e49379..cc2edb8 100644 --- a/wrw/proto.py +++ b/wrw/proto.py @@ -103,15 +103,15 @@ def simpleerror(env, startreq, code, title, msg): return [buf] def urlq(url): - if isinstance(url, unicode): + if isinstance(url, str): url = url.encode("utf-8") ret = "" - invalid = "&=#?/\"'" + invalid = b"&=#?/\"'" for c in url: - if c in invalid or (ord(c) <= 32) or (ord(c) >= 128): - ret += "%%%02X" % ord(c) + if c in invalid or (c <= 32) or (c >= 128): + ret += "%%%02X" % c else: - ret += c + ret += chr(c) return ret class urlerror(ValueError): -- 2.11.0