From 5c0a3965cdb9cac87d0b0ea773a6276c73a27ba6 Mon Sep 17 00:00:00 2001 From: Helmut Grohne Date: Sun, 29 Mar 2009 17:42:48 +0200 Subject: quite some changes for py3 These changes introduce some compatibility code. They don't make wsgitools usable with Python 3.0, but they also don't break compatibility with Python 2.5. --- wsgitools/digest.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'wsgitools/digest.py') diff --git a/wsgitools/digest.py b/wsgitools/digest.py index d99f67d..a4d2e4f 100755 --- a/wsgitools/digest.py +++ b/wsgitools/digest.py @@ -10,6 +10,10 @@ except ImportError: import binascii import base64 import time +try: + long +except NameError: + long = int sysrand = random.SystemRandom() @@ -33,7 +37,7 @@ def parse_digest_response(data, ret=dict()): >>> try: ... parse_digest_response('spam') ... except ValueError: - ... print "ValueError" + ... print("ValueError") ValueError """ data = data.strip() @@ -45,7 +49,7 @@ def parse_digest_response(data, ret=dict()): ret[key] = value return ret if rest[0] != ',': - raise ValueError, "invalid digest response" + raise ValueError("invalid digest response") rest = rest[1:] else: if ',' not in rest: -- cgit v1.2.3