Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions ietf/submit/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1213,11 +1213,9 @@ def process_submission_text(filename, revision):
f"Text Internet-Draft revision ({text_draft.revision}) "
f"disagrees with submission revision ({revision})"
)
title = _normalize_title(text_draft.get_title())
if not title:
# This test doesn't work well - the text_draft parser tends to grab "Abstract" as
# the title if there's an empty title.
raise SubmissionError("Could not extract a title from the text")
title = text_draft.get_title()
if title:
title = _normalize_title(title)

# Drops \r, \n, <, >. Based on get_draft_meta() behavior
trans_table = str.maketrans("", "", "\r\n<>")
Expand All @@ -1233,7 +1231,7 @@ def process_submission_text(filename, revision):
return {
"filename": text_draft.filename,
"rev": text_draft.revision,
"title": _normalize_title(text_draft.get_title()),
"title": title,
"authors": authors,
"abstract": text_draft.get_abstract(),
"document_date": text_draft.get_creation_date(),
Expand Down Expand Up @@ -1286,6 +1284,9 @@ def process_and_validate_submission(submission):
submission.title = text_metadata["title"]
submission.authors = text_metadata["authors"]

if not submission.title:
raise SubmissionError("Could not determine the title of the draft")

# Items always to get from text, even when XML is available
submission.abstract = text_metadata["abstract"]
submission.document_date = text_metadata["document_date"]
Expand Down
2 changes: 1 addition & 1 deletion ietf/utils/draft.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ def __init__(self, text, source, name_from_source=False):
"""
super().__init__()
assert isinstance(text, str)
self.source = source
self.source = str(source)
self.rawtext = text
self.name_from_source = name_from_source

Expand Down