4 from fnpdjango.utils.text.slughifi import char_map
6 # PayU chokes on non-Polish diacritics.
7 # Punctuation is handled correctly and escaped as needed,
8 # with the notable exception of backslash.
9 sane_in_payu_title = re.escape(
12 u'ąćęłńóśźżĄĆĘŁŃÓŚŹŻ' +
15 "".join(set(string.punctuation) - set('\\'))
20 return char_map.get(char, '')
22 def sanitize_payment_title(value):
23 return re.sub('[^%s]{1}' % sane_in_payu_title, replace_char, unicode(value))