Added a guard against feeding int() a non-numeric string during submission confirmation and a log assertion to report same.

- Legacy-Id: 14202
This commit is contained in:
Henrik Levkowetz 2017-10-10 15:02:00 +00:00
parent 8929437b77
commit ac69d9889d

View file

@ -90,7 +90,8 @@ def validate_submission_rev(name, rev):
return 'Revision must be between 00 and 99'
expected = 0
existing_revs = [int(i.rev) for i in Document.objects.filter(name=name)]
existing_revs = [int(i.rev) for i in Document.objects.filter(name=name) if i.rev and i.rev.isdigit() ]
log.assertion('[ i.rev for i in Document.objects.filter(name=name) if not (i.rev and i.rev.isdigit()) ] == []')
if existing_revs:
expected = max(existing_revs) + 1