Corrected the extent of a try/except block, moving more code inside the block. Fixes a submission exception that should just be a document error reported back to the user.
- Legacy-Id: 17411
This commit is contained in:
parent
ec13af6c43
commit
0f6a886ae0
|
@ -317,8 +317,6 @@ class SubmissionBaseUploadForm(forms.Form):
|
|||
txt_file.seek(0)
|
||||
try:
|
||||
text = bytes.decode(self.file_info['txt'].charset)
|
||||
except (UnicodeDecodeError, LookupError) as e:
|
||||
self.add_error('txt', 'Failed decoding the uploaded file: "%s"' % str(e))
|
||||
#
|
||||
self.parsed_draft = Draft(text, txt_file.name)
|
||||
if self.filename == None:
|
||||
|
@ -333,6 +331,8 @@ class SubmissionBaseUploadForm(forms.Form):
|
|||
self.title = self.parsed_draft.get_title()
|
||||
elif self.title != self.parsed_draft.get_title():
|
||||
self.add_error('txt', "Inconsistent title information: xml:%s, txt:%s" % (self.title, self.parsed_draft.get_title()))
|
||||
except (UnicodeDecodeError, LookupError) as e:
|
||||
self.add_error('txt', 'Failed decoding the uploaded file: "%s"' % str(e))
|
||||
|
||||
# The following errors are likely noise if we have previous field
|
||||
# errors:
|
||||
|
|
Loading…
Reference in a new issue