Exemple #1
0
 def clean(self, value):
     value = super(HtmlCleaningCharField, self).clean(value)
     if is_shouting(value):
         raise forms.ValidationError(
             'Please moderate the amount of upper case characters in your post...'
         )
     return clean_html(value)
Exemple #2
0
 def clean(self, value):
     value = super(HtmlCleaningCharField, self).clean(value)
     if is_shouting(value):
         raise forms.ValidationError('Please moderate the amount of upper case characters in your post...')
     try:
         return clean_html(value)
     except (HTMLParseError, UnicodeEncodeError):
         raise forms.ValidationError('The text you submitted is badly formed HTML, please fix it')
Exemple #3
0
    def clean(self, value):
        value = super(HtmlCleaningCharField, self).clean(value)

        if is_shouting(value):
            raise forms.ValidationError('Please moderate the amount of upper case characters in your post...')
        try:
            return clean_html(value)
        except HTMLParseError:
            raise forms.ValidationError('The text you submitted is badly formed HTML, please fix it')
Exemple #4
0
 def test_is_shouting(self):
     (is_shouting(''))
     self.assertTrue(is_shouting('HELLO THIS IS SHOUTING!!!'))
     self.assertFalse(is_shouting('This is a phrase WITH SOME emphasis!!'))
     self.assertFalse(is_shouting('This is a regular phrase.'))
Exemple #5
0
 def test_is_shouting(self):
     (is_shouting(''))
     self.assertTrue(is_shouting('HELLO THIS IS SHOUTING!!!'))
     self.assertFalse(is_shouting('This is a phrase WITH SOME emphasis!!'))
     self.assertFalse(is_shouting('This is a regular phrase.'))