Пример #1
0
def remove_accent_errors(exception):
    """
    Implements the 'remove_accent' error handling (for encoding with text encodings only): the unencodable character
    is replaced by an character without accent (characters are converted to ASCII).
    """
    chunk = exception.object[exception.start:exception.end]
    return remove_accent(chunk), exception.end
Пример #2
0
    def get_anonymized_value(self, value):
        normalized_value = re.sub(r'[^A-Z ]', 'Q',
                                  remove_accent(value.strip()).upper())
        normalized_key = (settings.ANONYMIZATION_NAME_KEY[i % len(
            settings.ANONYMIZATION_NAME_KEY)]
                          for i in range(len(normalized_value)))

        return ''.join([
            v if v == ' ' else
            self._number_to_char(self._char_to_number(v) + int(k))
            for k, v in zip(normalized_key, normalized_value)
        ])
Пример #3
0
 def clean_content(self):
     if not settings.SMS_USE_ACCENT:
         self.content = six.text_type(
             remove_accent(six.text_type(self.content)))
Пример #4
0
 def ascii_content(self):
     return remove_accent(self.content).decode('utf-8')
Пример #5
0
 def clean_content(self):
     if not config.ATS_USE_ACCENT:
         self.content = six.text_type(remove_accent(six.text_type(self.content)))
Пример #6
0
 def test_should_remove_accent_from_string(self):
     assert_equal('escrzyaie', remove_accent('ěščřžýáíé'))
Пример #7
0
 def ascii_content(self):
     return remove_accent(self.content)
Пример #8
0
 def clean_content(self):
     if settings.OPERATOR_UNESCAPE_HTML:
         self.content = unescape(self.content)
     if not settings.USE_ACCENT:
         self.content = six.text_type(
             remove_accent(six.text_type(self.content)))
Пример #9
0
 def get_name(self):
     return force_text(remove_accent(force_text(self.model._meta.verbose_name_plural)))
Пример #10
0
 def get_name(self):
     return force_text(
         remove_accent(force_text(self.model._meta.verbose_name_plural)))
Пример #11
0
 def test_should_remove_accent_from_string(self):
     assert_equal('escrzyaie', remove_accent('ěščřžýáíé'))
Пример #12
0
 def clean_content(self):
     if not settings.SMS_USE_ACCENT:
         self.content = str(remove_accent(str(self.content)))
Пример #13
0
 def ascii_content(self):
     return remove_accent(self.content)