Tweaked the missing id submission revision message to work also with non-ascii characters in the draft name. Changed the disallowed character error message to be more useful by providing the found document name and byte codes for the disallowed characters.

- Legacy-Id: 9610
This commit is contained in:
Henrik Levkowetz 2015-05-11 11:23:56 +00:00
parent 213e769d76
commit 1bced6e46b
2 changed files with 5 additions and 3 deletions

View file

@ -60,16 +60,16 @@ class PlainParser(FileParser):
extra_chars = re.sub('[0-9a-z\-]', '', name)
if extra_chars:
if len(extra_chars) == 1:
self.parsed_info.add_error((u'The name contains a disallowed character: %s ' % (', '.join(set(extra_chars))).decode('ascii','replace')) +
self.parsed_info.add_error((u'The document name on the first page, "%s", contains a disallowed character with byte code: %s ' % (name.decode('utf-8','replace'), ord(extra_chars[0]))) +
u'(see https://www.ietf.org/id-info/guidelines.html#naming for details).')
else:
self.parsed_info.add_error((u'The name contains disallowed characters: %s ' % (', '.join(set(extra_chars))).decode('ascii','replace')) +
self.parsed_info.add_error((u'The document name on the first page, "%s", contains disallowed characters with byte codes: %s ' % (name.decode('utf-8','replace'), (', '.join([ str(ord(c)) for c in extra_chars] )))) +
u'(see https://www.ietf.org/id-info/guidelines.html#naming for details).')
match_revision = revisionre.match(name)
if match_revision:
self.parsed_info.metadata.rev = match_revision.group(1)
else:
self.parsed_info.add_error(u'The name found on the first page of the document does not contain a revision: "%s"' % (name,))
self.parsed_info.add_error(u'The name found on the first page of the document does not contain a revision: "%s"' % (name.decode('utf-8','replace'),))
name = re.sub('-\d+$', '', name)
self.parsed_info.metadata.name = name
return

View file

@ -0,0 +1,2 @@
<div>{% for item in help_text_and_errors %} {{ item }}<br/> {% endfor %}</div>