summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArmin Ronacher <armin.ronacher@active-4.com>2013-05-20 19:11:43 +0100
committerArmin Ronacher <armin.ronacher@active-4.com>2013-05-20 19:11:43 +0100
commit8d96ba7980f6d51128d25c44c439e5d39bcdcc99 (patch)
tree1e4dfbae6ccd5969ac456f90b4dd024ef49f7d54
parent08c34a3315ec94b237100dd42d4ddd7f406942d9 (diff)
downloadmarkupsafe-8d96ba7980f6d51128d25c44c439e5d39bcdcc99.tar.gz
Added compat module
-rw-r--r--markupsafe/_compat.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/markupsafe/_compat.py b/markupsafe/_compat.py
new file mode 100644
index 0000000..10627a6
--- /dev/null
+++ b/markupsafe/_compat.py
@@ -0,0 +1,24 @@
+# -*- coding: utf-8 -*-
+"""
+ markupsafe._compat
+ ~~~~~~~~~~~~~~~~~~
+
+ Compatibility module for different Python versions.
+
+ :copyright: (c) 2013 by Armin Ronacher.
+ :license: BSD, see LICENSE for more details.
+"""
+import sys
+
+PY2 = sys.version_info[0] == 2
+
+if not PY2:
+ text_type = str
+ string_types = (str,)
+ imap = map
+ unichr = chr
+else:
+ text_type = unicode
+ string_types = (str, unicode)
+ from itertools import imap
+ unichr = unichr