Added byte/str compatibility for python 3

This commit is contained in:
Jens Alm
2013-05-30 11:21:05 +02:00
parent bbfaf2c8d8
commit 4e81e5d5e8
3 changed files with 14 additions and 5 deletions

10
djrill/compat.py Normal file
View File

@@ -0,0 +1,10 @@
# For python 3 compatibility, see http://python3porting.com/problems.html#nicer-solutions
import sys
if sys.version < '3':
def b(x):
return x
else:
import codecs
def b(x):
return codecs.latin_1_encode(x)[0]