コード例 #1
0
ファイル: patch.py プロジェクト: druids/django-chamber
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
ファイル: resource.py プロジェクト: rubickcz/django-pyston
 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
ファイル: __init__.py プロジェクト: matllubos/django-chamber
 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)