reverted s.encode('translit/long') which breaks Pypy

This commit is contained in:
mdipierro
2014-03-12 13:31:09 -05:00
parent c14e5cbae5
commit 883909af4b
3 changed files with 6 additions and 4 deletions

View File

@@ -3,7 +3,7 @@ language: python
python:
- '2.6'
- '2.7'
# - 'pypy'
- 'pypy'
install:
- pip install -e .
env:

View File

@@ -1 +1 @@
Version 2.9.4-stable+timestamp.2014.03.09.17.28.42
Version 2.9.4-stable+timestamp.2014.03.12.13.30.12

View File

@@ -17,10 +17,11 @@ import cgi
import urllib
import struct
import decimal
import unicodedata
from cStringIO import StringIO
from gluon.utils import simple_hash, web2py_uuid, DIGEST_ALG_BY_SIZE
from gluon.dal import FieldVirtual, FieldMethod
from gluon.contrib import translitcodec
# from gluon.contrib import translitcodec
regex_isint = re.compile('^[+-]?\d+$')
@@ -2519,7 +2520,8 @@ def urlify(s, maxlen=80, keep_underscores=False):
if isinstance(s, str):
s = s.decode('utf-8') # to unicode
s = s.lower() # to lowercase
s = s.encode('translit/long') # replace special characters
s = unicodedata.normalize('NFKD', s) # replace special characters
# s = s.encode('translit/long') # (proposed change to above line breaks Pypy)
s = s.encode('ascii', 'ignore') # encode as ASCII
s = re.sub('&\w+?;', '', s) # strip html entities
if keep_underscores: