Skip to content

Commit c4298f6

Browse files
committed
Offer text from latest approved revision in case there's no initial text
for a recharter submit form. - Legacy-Id: 4350
1 parent 5fcd029 commit c4298f6

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

ietf/wgcharter/views.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,9 +245,10 @@ def submit(request, name):
245245
not_uploaded_yet = charter.rev.endswith("-00") and not os.path.exists(os.path.join(settings.CHARTER_PATH, '%s-%s.txt' % (charter.canonical_name(), charter.rev)))
246246

247247
if not_uploaded_yet:
248+
# this case is special - we recently chartered or rechartered and have no file yet
248249
next_rev = charter.rev
249250
else:
250-
# Search history for possible collisions with abandoned efforts
251+
# search history for possible collisions with abandoned efforts
251252
prev_revs = list(charter.history_set.order_by('-time').values_list('rev', flat=True))
252253
next_rev = next_revision(charter.rev)
253254
while next_rev in prev_revs:
@@ -276,7 +277,17 @@ def submit(request, name):
276277
return HttpResponseRedirect(reverse('doc_view', kwargs={'name': charter.name}))
277278
else:
278279
init = { "content": ""}
279-
filename = os.path.join(settings.CHARTER_PATH, '%s-%s.txt' % (charter.canonical_name(), charter.rev))
280+
c = charter
281+
282+
if not_uploaded_yet:
283+
# use text from last approved revision
284+
last_approved = charter.rev.split("-")[0]
285+
h = charter.history_set.filter(rev=last_approved).order_by("-time", "-id")
286+
if h:
287+
c = h[0]
288+
289+
filename = os.path.join(settings.CHARTER_PATH, '%s-%s.txt' % (c.canonical_name(), c.rev))
290+
280291
try:
281292
with open(filename, 'r') as f:
282293
init["content"] = f.read()

0 commit comments

Comments
 (0)