From 883909af4b4c84f18a4ca6340f7ed418c017c14f Mon Sep 17 00:00:00 2001 From: mdipierro Date: Wed, 12 Mar 2014 13:31:09 -0500 Subject: [PATCH] reverted s.encode('translit/long') which breaks Pypy --- .travis.yml | 2 +- VERSION | 2 +- gluon/validators.py | 6 ++++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1dd3e406..e97ee906 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,7 @@ language: python python: - '2.6' - '2.7' -# - 'pypy' + - 'pypy' install: - pip install -e . env: diff --git a/VERSION b/VERSION index fefc2ec1..0b74b001 100644 --- a/VERSION +++ b/VERSION @@ -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 diff --git a/gluon/validators.py b/gluon/validators.py index 18c0a897..16dd47c9 100644 --- a/gluon/validators.py +++ b/gluon/validators.py @@ -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: