Commits

Simone Marzola committed 8afa281

not_empty NaiveDateTimeValidator, fixed imports

  • Participants
  • Parent commits 439477b

Comments (0)

Files changed (2)

File smallpress/lib/forms.py

                          placeholder=l_('tags, comma separated'))
         content = TextArea(label=None, key='content', name='content', id="article_content",
                            validator=UnicodeString(not_empty=True, outputEncoding=None))
-        publish_date = TextField(label='Publish Date', validator=NaiveDateTimeValidator())
+        publish_date = TextField(label='Publish Date', validator=NaiveDateTimeValidator(not_empty=True))
 
     @ajaxloaded
     class UploadForm(ListForm):
                              attrs=dict(placeholder=l_('tags, comma separated')))
             content = TextArea(suppress_label=True, validator=UnicodeString(not_empty=True),
                                attrs=dict(id='article_content'))
-            publish_date = TextField(label_text='Publish Date', validator=NaiveDateTimeValidator())
+            publish_date = TextField(label_text='Publish Date', validator=NaiveDateTimeValidator(not_empty=True))
 
     @ajaxloaded
     class UploadForm(ListForm):

File smallpress/lib/validators.py

 from datetime import datetime
-try:
-    from tw.forms.validators import FancyValidator, Invalid
-except ImportError:
-    from formencode.validators import FancyValidator, Invalid
+from formencode.validators import FancyValidator, Invalid
 
 class NaiveDateTimeValidator(FancyValidator):