0001-misc-also-simplify-hashes-and-underscores-21227.patch
tests/test_misc.py | ||
---|---|---|
91 | 91 |
assert simplify('test\'again') == 'test-again' |
92 | 92 |
assert simplify('test\'\'\'again') == 'test-again' |
93 | 93 | |
94 |
def test_simplify_dashes_and_underscores(): |
|
95 |
assert simplify('8100-03_PT') == '8100-03-pt' |
|
96 |
assert simplify('8100-03_PT', ' ') == '8100 03 pt' |
|
97 |
assert simplify('8100-03_PT', '_') == '8100_03_pt' |
|
98 | ||
94 | 99 |
def test_simplify_accented(): |
95 | 100 |
assert simplify(u'cliché') == 'cliche' |
96 | 101 |
assert simplify(u'cliché'.encode('iso-8859-1')) == 'cliche' |
wcs/qommon/misc.py | ||
---|---|---|
154 | 154 |
else: |
155 | 155 |
s = unicode(s, 'iso-8859-1', 'ignore') |
156 | 156 |
s = unicodedata.normalize('NFKD', s).encode('ascii', 'ignore') |
157 |
s = re.sub(r'[^\w\s\'%s]' % space, '', s).strip().lower() |
|
158 |
s = re.sub(r'[\s\'%s]+' % space, space, s) |
|
157 |
s = re.sub(r'[^\w\s\'_\-%s]' % space, '', s).strip().lower()
|
|
158 |
s = re.sub(r'[\s\'_\-%s]+' % space, space, s)
|
|
159 | 159 |
return s |
160 | 160 | |
161 | 161 |
def get_datetime_language(): |
162 |
- |