Zine

open source content publishing system


Changeset 1299:fb540c42162b


Ignore:
Timestamp:
01/11/10 22:18:43 (2 years ago)
Author:
mitsuhiko
Branch:
default
rebase_source:
2e55f41bb43c44448dd345aaa05ba1b65160d816
Message:

No longer possible to commit empty comments.

Location:
zine
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • zine/forms.py

    r1284 r1299  
    109109    )]) 
    110110    body = forms.TextField(lazy_gettext(u'Text'), min_length=2, max_length=6000, 
    111                            messages=dict( 
     111                           required=True, messages=dict( 
    112112        too_short=lazy_gettext(u'Your comment is too short.'), 
    113113        too_long=lazy_gettext(u'Your comment is too long.'), 
     
    140140        if not self.post.comments_enabled: 
    141141            raise ValidationError(_('Post is closed for commenting.')) 
    142         elif self.post.comments_closed: 
     142        if self.post.comments_closed: 
    143143            raise ValidationError(_('Commenting is no longer possible.')) 
    144144 
  • zine/utils/forms.py

    r1287 r1299  
    12501250    def convert(self, value): 
    12511251        value = _to_string(value) 
    1252         if self.required: 
    1253             if not value: 
    1254                 raise ValidationError(self.messages['required']) 
    1255         elif value: 
     1252        if self.required and not value: 
     1253            raise ValidationError(self.messages['required']) 
     1254        if value: 
    12561255            if self.min_length is not None and len(value) < self.min_length: 
    12571256                message = self.messages['too_short'] 
Note: See TracChangeset for help on using the changeset viewer.