summaryrefslogtreecommitdiff
path: root/sleekxmpp/util/stringprep_profiles.py
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2012-07-31 21:33:19 -0700
committerLance Stout <lancestout@gmail.com>2012-07-31 21:33:19 -0700
commit06a9d9fc3075df8e07960716c25d1eca2eb47f05 (patch)
tree94adfe3467fb50e3710548d6c97f1a6b36ed57a8 /sleekxmpp/util/stringprep_profiles.py
parent44ce01a70b7926a1e1f4af6692be3bdc671f7318 (diff)
parent1383ca19b50ae7463a1f310f007ed120f811b574 (diff)
downloadslixmpp-06a9d9fc3075df8e07960716c25d1eca2eb47f05.tar.gz
slixmpp-06a9d9fc3075df8e07960716c25d1eca2eb47f05.tar.bz2
slixmpp-06a9d9fc3075df8e07960716c25d1eca2eb47f05.tar.xz
slixmpp-06a9d9fc3075df8e07960716c25d1eca2eb47f05.zip
Merge branch 'master' into develop
Conflicts: sleekxmpp/thirdparty/__init__.py
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