+
+def _no_diacritics_regexp(query):
+ """ returns a regexp for searching for a query without diacritics
+
+ should be locale-aware """
+ names = {'a':u'ą', 'c':u'ć', 'e':u'ę', 'l': u'ł', 'n':u'ń', 'o':u'ó', 's':u'ś', 'z':u'ź|ż'}
+ def repl(m):
+ l = m.group()
+ return "(%s|%s)" % (l, names[l])
+ return re.sub('[%s]'%(''.join(names.keys())), repl, query)
+