diff options
| author | Val Neekman <val@neekware.com> | 2018-03-25 09:16:14 -0400 |
|---|---|---|
| committer | Val Neekman <val@neekware.com> | 2018-03-25 09:16:14 -0400 |
| commit | d12d1fc3851628dba7b071d13d1e61ccbf636fa2 (patch) | |
| tree | e151395fb1f1b038215fd8abcfcf28c93a9405c1 /slugify | |
| parent | 52e5c3652a2fb1297dd5997c71c38fa4d7f78f73 (diff) | |
| parent | 874fe140aa68ee1065e2170385f8c4ace5ac644a (diff) | |
| download | python-slugify-d12d1fc3851628dba7b071d13d1e61ccbf636fa2.tar.gz | |
support of text-unidecode
Diffstat (limited to 'slugify')
| -rw-r--r-- | slugify/__init__.py | 2 | ||||
| -rw-r--r-- | slugify/slugify.py | 10 |
2 files changed, 7 insertions, 5 deletions
diff --git a/slugify/__init__.py b/slugify/__init__.py index 79e1d28..02393a1 100644 --- a/slugify/__init__.py +++ b/slugify/__init__.py @@ -3,4 +3,4 @@ from .slugify import * __author__ = 'Val Neekman @ Neekware Inc. [@vneekman]' __description__ = 'A Python slugify application that also handles Unicode' -__version__ = '1.2.4' +__version__ = '1.2.5' diff --git a/slugify/slugify.py b/slugify/slugify.py index af0c609..99afb7f 100644 --- a/slugify/slugify.py +++ b/slugify/slugify.py @@ -13,8 +13,10 @@ except ImportError: _unicode_type = str unichr = chr -import unidecode - +try: + import unidecode +except ImportError: + import text_unidecode as unidecode __all__ = ['slugify', 'smart_truncate'] @@ -110,14 +112,14 @@ def slugify(text, entities=True, decimal=True, hexadecimal=True, max_length=0, w if decimal: try: text = DECIMAL_PATTERN.sub(lambda m: unichr(int(m.group(1))), text) - except: + except Exception: pass # hexadecimal character reference if hexadecimal: try: text = HEX_PATTERN.sub(lambda m: unichr(int(m.group(1), 16)), text) - except: + except Exception: pass # translate |
