summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Halley <halley@dnspython.org>2014-06-19 05:41:48 -0700
committerBob Halley <halley@dnspython.org>2014-06-19 05:41:48 -0700
commit70b99aa0172de58d6a71b987bf71656fcf8c11f8 (patch)
treebd8f911b3ce2e9277fca408a5a0d77af49a9d9ea
parent46580d815ac1ae8677e3fbc01d48d0f5351ae2d3 (diff)
downloaddnspython-70b99aa0172de58d6a71b987bf71656fcf8c11f8.tar.gz
In _escapify, rename whitespaces_only to unicode_mode
-rw-r--r--dns/name.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/dns/name.py b/dns/name.py
index 0d9b4f2..5eb925d 100644
--- a/dns/name.py
+++ b/dns/name.py
@@ -88,9 +88,9 @@ _escaped = {
'$' : True
}
-def _escapify(label, whitespaces_only=False):
+def _escapify(label, unicode_mode=False):
"""Escape the characters in label which need it.
- @param whitespaces_only: escapify only special and whitespace (ord < 0x20)
+ @param unicode_mode: escapify only special and whitespace (<= 0x20)
characters
@returns: the escaped string
@rtype: string"""
@@ -101,7 +101,7 @@ def _escapify(label, whitespaces_only=False):
elif ord(c) > 0x20 and ord(c) < 0x7F:
text += c
else:
- if whitespaces_only and ord(c) >= 0x7F:
+ if unicode_mode and ord(c) >= 0x7F:
text += c
else:
text += '\\%03d' % ord(c)
@@ -357,7 +357,7 @@ class Name(object):
l = self.labels[:-1]
else:
l = self.labels
- s = u'.'.join([_escapify(encodings.idna.ToUnicode(x), whitespaces_only=True) for x in l])
+ s = u'.'.join([_escapify(encodings.idna.ToUnicode(x), True) for x in l])
return s
def to_digestable(self, origin=None):