|
39 |
|
39 |
|
40 |
import six |
40 |
import six |
41 |
from ldap.filter import filter_format |
41 |
from ldap.filter import filter_format |
|
|
42 |
import unidecode |
42 |
|
43 |
|
43 |
import univention.config_registry |
44 |
import univention.config_registry |
44 |
import univention.debug as ud |
45 |
import univention.debug as ud |
Lines 133-141
def pattern_replace(pattern, object):
|
Link Here
|
---|
|
133 |
elif iCmd == 'umlauts': |
134 |
elif iCmd == 'umlauts': |
134 |
if isinstance(text, bytes): |
135 |
if isinstance(text, bytes): |
135 |
text = text.decode('UTF-8') |
136 |
text = text.decode('UTF-8') |
136 |
for umlaut, code in property.UMLAUTS.items(): |
137 |
text = unidecode.unidecode(text) |
137 |
text = text.replace(umlaut, code) |
|
|
138 |
|
139 |
text = unicodedata.normalize('NFKD', text).encode('ascii', 'ignore').decode('ascii') |
138 |
text = unicodedata.normalize('NFKD', text).encode('ascii', 'ignore').decode('ascii') |
140 |
elif iCmd == 'alphanum': |
139 |
elif iCmd == 'alphanum': |
141 |
whitelist = configRegistry.get('directory/manager/templates/alphanum/whitelist', '') |
140 |
whitelist = configRegistry.get('directory/manager/templates/alphanum/whitelist', '') |
Lines 191-260
def pattern_replace(pattern, object):
|
Link Here
|
---|
|
191 |
|
190 |
|
192 |
|
191 |
|
193 |
class property: |
192 |
class property: |
194 |
UMLAUTS = { |
|
|
195 |
u'À': u'A', |
196 |
u'Á': u'A', |
197 |
u'Â': u'A', |
198 |
u'Ã': u'A', |
199 |
u'Ä': u'Ae', |
200 |
u'Å': u'A', |
201 |
u'Æ': u'AE', |
202 |
u'Ç': u'C', |
203 |
u'È': u'E', |
204 |
u'É': u'E', |
205 |
u'Ê': u'E', |
206 |
u'Ë': u'E', |
207 |
u'Ì': u'I', |
208 |
u'Í': u'I', |
209 |
u'Î': u'I', |
210 |
u'Ï': u'I', |
211 |
u'Ð': u'D', |
212 |
u'Ñ': u'N', |
213 |
u'Ò': u'O', |
214 |
u'Ó': u'O', |
215 |
u'Ô': u'O', |
216 |
u'Õ': u'O', |
217 |
u'Ö': u'Oe', |
218 |
u'Ø': u'O', |
219 |
u'Ù': u'U', |
220 |
u'Ú': u'U', |
221 |
u'Û': u'U', |
222 |
u'Ü': u'Ue', |
223 |
u'Ý': u'Y', |
224 |
u'Þ': u'P', |
225 |
u'ß': u'ss', |
226 |
u'à': u'a', |
227 |
u'á': u'a', |
228 |
u'â': u'a', |
229 |
u'ã': u'a', |
230 |
u'ä': u'ae', |
231 |
u'å': u'a', |
232 |
u'æ': u'ae', |
233 |
u'ç': u'c', |
234 |
u'è': u'e', |
235 |
u'é': u'e', |
236 |
u'ê': u'e', |
237 |
u'ë': u'e', |
238 |
u'ì': u'i', |
239 |
u'í': u'i', |
240 |
u'î': u'i', |
241 |
u'ï': u'i', |
242 |
u'ð': u'o', |
243 |
u'ñ': u'n', |
244 |
u'ò': u'o', |
245 |
u'ó': u'o', |
246 |
u'ô': u'o', |
247 |
u'õ': u'o', |
248 |
u'ö': u'oe', |
249 |
u'ø': u'o', |
250 |
u'ù': u'u', |
251 |
u'ú': u'u', |
252 |
u'û': u'u', |
253 |
u'ü': u'ue', |
254 |
u'ý': u'y', |
255 |
u'þ': u'p', |
256 |
u'ÿ': u'y' |
257 |
} |
258 |
|
193 |
|
259 |
def __init__( |
194 |
def __init__( |
260 |
self, |
195 |
self, |