344
344
# The comment field is only required if filing a new bug.
345
345
if self.submit_bug_action.submitted():
346
346
comment = data.get('comment')
348
if len(comment) > IBug['description'].max_length:
349
self.setFieldError('comment',
350
'The description is too long. If you have lots '
351
'text to add, attach a file to the bug instead.')
353
self.setFieldError('comment', "Required input is missing.")
347
# The widget only exposes the error message. The private
348
# attr contains the real error.
349
widget_error = self.widgets.get('comment')._error
350
if widget_error and isinstance(widget_error.errors, TooLong):
351
self.setFieldError('comment',
352
'The description is too long. If you have lots '
353
'text to add, attach a file to the bug instead.')
354
elif not comment or widget_error is not None:
356
'comment', "Provide details about the issue.")
354
357
# Check a bug has been selected when the user wants to
355
358
# subscribe to an existing bug.
356
359
elif self.this_is_my_bug_action.submitted():