summaryrefslogtreecommitdiff
path: root/sleekxmpp/util/stringprep_profiles.py
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2012-07-29 17:22:16 -0700
committerLance Stout <lancestout@gmail.com>2012-07-30 19:15:10 -0700
commit695cd95657585006a696243a1c8249f9d90b506e (patch)
tree3f4b4ff419b2cba9970da78b84b1b7bb059a3a9a /sleekxmpp/util/stringprep_profiles.py
parente4b4c676379df30d268d28341b643cd9cd10eb22 (diff)
downloadslixmpp-695cd95657585006a696243a1c8249f9d90b506e.tar.gz
slixmpp-695cd95657585006a696243a1c8249f9d90b506e.tar.bz2
slixmpp-695cd95657585006a696243a1c8249f9d90b506e.tar.xz
slixmpp-695cd95657585006a696243a1c8249f9d90b506e.zip
Update and integrate Suelta.
Diffstat (limited to 'sleekxmpp/util/stringprep_profiles.py')
-rw-r--r--sleekxmpp/util/stringprep_profiles.py12
1 files changed, 3 insertions, 9 deletions
diff --git a/sleekxmpp/util/stringprep_profiles.py b/sleekxmpp/util/stringprep_profiles.py
index 08278d6c..ad89d4cc 100644
--- a/sleekxmpp/util/stringprep_profiles.py
+++ b/sleekxmpp/util/stringprep_profiles.py
@@ -20,19 +20,13 @@ import sys
import stringprep
import unicodedata
+from sleekxmpp.util import unicode
+
class StringPrepError(UnicodeError):
pass
-def to_unicode(data):
- """Ensure that a given string is Unicode, regardless of Python version."""
- if sys.version_info < (3, 0):
- return unicode(data)
- else:
- return str(data)
-
-
def b1_mapping(char):
"""Map characters that are commonly mapped to nothing."""
return '' if stringprep.in_table_b1(char) else None
@@ -143,7 +137,7 @@ def create(nfkc=True, bidi=True, mappings=None,
"""
def profile(data, query=False):
try:
- data = to_unicode(data)
+ data = unicode(data)
except UnicodeError:
raise StringPrepError