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
+1 -1
View File
@@ -3,7 +3,7 @@ language: python
python: python:
- '2.6' - '2.6'
- '2.7' - '2.7'
# - 'pypy' - 'pypy'
install: install:
- pip install -e . - pip install -e .
env: env:
+1 -1
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
+4 -2
View File
@@ -17,10 +17,11 @@ import cgi
import urllib import urllib
import struct import struct
import decimal import decimal
import unicodedata
from cStringIO import StringIO from cStringIO import StringIO
from gluon.utils import simple_hash, web2py_uuid, DIGEST_ALG_BY_SIZE from gluon.utils import simple_hash, web2py_uuid, DIGEST_ALG_BY_SIZE
from gluon.dal import FieldVirtual, FieldMethod from gluon.dal import FieldVirtual, FieldMethod
from gluon.contrib import translitcodec # from gluon.contrib import translitcodec
regex_isint = re.compile('^[+-]?\d+$') regex_isint = re.compile('^[+-]?\d+$')
@@ -2519,7 +2520,8 @@ def urlify(s, maxlen=80, keep_underscores=False):
if isinstance(s, str): if isinstance(s, str):
s = s.decode('utf-8') # to unicode s = s.decode('utf-8') # to unicode
s = s.lower() # to lowercase 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 = s.encode('ascii', 'ignore') # encode as ASCII
s = re.sub('&\w+?;', '', s) # strip html entities s = re.sub('&\w+?;', '', s) # strip html entities
if keep_underscores: if keep_underscores: