[Python-checkins] r45393 - python/trunk/Lib/encodings/idna.py (original) (raw)
walter.doerwald python-checkins at python.org
Fri Apr 14 17:22:27 CEST 2006
- Previous message: [Python-checkins] r45392 - python/trunk/configure python/trunk/configure.in
- Next message: [Python-checkins] r45394 - python/trunk/Lib/codecs.py
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Author: walter.doerwald Date: Fri Apr 14 17:22:27 2006 New Revision: 45393
Modified: python/trunk/Lib/encodings/idna.py Log: Make raise statements PEP 8 compatible.
Modified: python/trunk/Lib/encodings/idna.py
--- python/trunk/Lib/encodings/idna.py (original)
+++ python/trunk/Lib/encodings/idna.py Fri Apr 14 17:22:27 2006
@@ -35,7 +35,7 @@
stringprep.in_table_c7(c) or
stringprep.in_table_c8(c) or
stringprep.in_table_c9(c):
raise UnicodeError, "Invalid character %s" % repr(c)
raise UnicodeError("Invalid character %r" % c)
RandAL = map(stringprep.in_table_d1, label) Check bidi
@@ -48,14 +48,14 @@ # 2) If a string contains any RandALCat character, the string # MUST NOT contain any LCat character. if filter(stringprep.in_table_d2, label):
raise UnicodeError, "Violation of BIDI requirement 2"
raise UnicodeError("Violation of BIDI requirement 2") # 3) If a string contains any RandALCat character, a # RandALCat character MUST be the first character of the # string, and a RandALCat character MUST be the last # character of the string. if not RandAL[0] or not RandAL[-1]:
raise UnicodeError, "Violation of BIDI requirement 3"
return labelraise UnicodeError("Violation of BIDI requirement 3")
@@ -70,7 +70,7 @@ # Skip to step 8. if 0 < len(label) < 64: return label
raise UnicodeError, "label too long"
raise UnicodeError("label too long")
label = nameprep(label) Step 2: nameprep
@@ -85,11 +85,11 @@ # Skip to step 8. if 0 < len(label) < 64: return label
raise UnicodeError, "label too long"
raise UnicodeError("label too long")
if label.startswith(uace_prefix): Step 5: Check ACE prefix
raise UnicodeError, "Label starts with ACE prefix"
raise UnicodeError("Label starts with ACE prefix")
label = label.encode("punycode") Step 6: Encode with PUNYCODE
@@ -100,7 +100,7 @@ # Step 8: Check size if 0 < len(label) < 64: return label
- raise UnicodeError, "label too long"
- raise UnicodeError("label too long")
def ToUnicode(label): # Step 1: Check for ASCII @@ -119,7 +119,7 @@ try: label = label.encode("ascii") except UnicodeError:
raise UnicodeError, "Invalid character in IDN label"
raise UnicodeError("Invalid character in IDN label")
if not label.startswith(ace_prefix): return unicode(label, "ascii") Step 3: Check for ACE prefix
@@ -136,7 +136,7 @@ # Step 7: Compare the result of step 6 with the one of step 3 # label2 will already be in lower case. if label.lower() != label2:
raise UnicodeError, ("IDNA does not round-trip", label, label2)
raise UnicodeError("IDNA does not round-trip", label, label2)
return result Step 8: return the result of step 5
@@ -148,7 +148,7 @@
if errors != 'strict':
# IDNA is quite clear that implementations must be strict
raise UnicodeError, "unsupported error handling "+errors
raise UnicodeError("unsupported error handling "+errors) if not input: return "", 0
@@ -168,7 +168,7 @@ def decode(self,input,errors='strict'):
if errors != 'strict':
raise UnicodeError, "Unsupported error handling "+errors
raise UnicodeError("Unsupported error handling "+errors) if not input: return u"", 0
- Previous message: [Python-checkins] r45392 - python/trunk/configure python/trunk/configure.in
- Next message: [Python-checkins] r45394 - python/trunk/Lib/codecs.py
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]