File tree Expand file tree Collapse file tree 3 files changed +5
-5
lines changed Expand file tree Collapse file tree 3 files changed +5
-5
lines changed Original file line number Diff line number Diff line change 66
77
88def string_required (value ):
9- if value is None or value == '' :
9+ if value is None or value . strip () == '' :
1010 raise ValidationValueError ('Value must not be empty.' )
1111 return True
1212
Original file line number Diff line number Diff line change @@ -4160,7 +4160,7 @@ def test_create_comment_content_cannot_be_empty(self):
41604160 is_public = True ,
41614161 content = ''
41624162 )
4163- assert_equal (error .exception .message , 'Ensure this value is not empty.' )
4163+ assert_equal (error .exception .message , 'Value must not be empty.' )
41644164
41654165 def test_create_comment_content_cannot_be_whitespace (self ):
41664166 with assert_raises (ValidationValueError ) as error :
@@ -4172,7 +4172,7 @@ def test_create_comment_content_cannot_be_whitespace(self):
41724172 is_public = True ,
41734173 content = ' '
41744174 )
4175- assert_equal (error .exception .message , 'Ensure this value is not empty.' )
4175+ assert_equal (error .exception .message , 'Value must not be empty.' )
41764176
41774177 def test_create_sends_comment_added_signal (self ):
41784178 with capture_signals () as mock_signals :
Original file line number Diff line number Diff line change 1717
1818from modularodm import Q
1919from modularodm import fields
20- from modularodm .validators import MaxLengthValidator , ValueNotEmptyValidator
20+ from modularodm .validators import MaxLengthValidator
2121from modularodm .exceptions import NoResultsFound
2222from modularodm .exceptions import ValidationTypeError
2323from modularodm .exceptions import ValidationValueError
@@ -181,7 +181,7 @@ class Comment(GuidStoredObject):
181181
182182 is_deleted = fields .BooleanField (default = False )
183183 content = fields .StringField (required = True ,
184- validate = ( MaxLengthValidator (settings .COMMENT_MAXLENGTH ), ValueNotEmptyValidator ()) )
184+ validate = [ MaxLengthValidator (settings .COMMENT_MAXLENGTH ), validators . string_required ] )
185185
186186 # Dictionary field mapping user IDs to dictionaries of report details:
187187 # {
You can’t perform that action at this time.
0 commit comments