Slplited python compat file for python 2.x and 3.x

This commit is contained in:
Renato Filho 2011-10-06 15:06:29 -03:00 • committed by Hugo Parente Lima
commit c33a78cdd4
3 changed files with 66 additions and 0 deletions

View file

@ -0,0 +1,18 @@
def b(s):
return s
def l(n):
return long(n)
def unicode_(s):
if type(s) == str:
import codecs
c = codecs.lookup('utf-8')
s2 = c.decode(s, 'ignore')
return s2[0]
return u'%s' % s
unicode = unicode
unichr = unichr
long = long
buffer = buffer