Skip to content

Commit c9cb6a6

Browse files
committed
Merged in [11083] from stephen.farrell@cs.tcd.ie, with some tweaks:
Assigned default consensus for IETF stream documents, partly fixing ietf-tools#1403 - IRTF/IAB may want more, this just does IETF stream. - Legacy-Id: 11089 Note: SVN reference [11083] has been migrated to Git commit 9ca4e98
2 parents 59a74b6 + 9ca4e98 commit c9cb6a6

4 files changed

Lines changed: 24 additions & 8 deletions

File tree

hold-for-merge

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- conf-mode -*-
22

3-
^/personal/anurag_nc/6.18.2.dev0@11071 # Doesn't pass tests, needs rework
3+
/personal/anurag_nc/6.18.2.dev0@11071 # Doesn't pass tests, needs rework
44
/personal/rcross/v6.8.1.dev0@10727 # Loads of whitespace changes. Pyflakes issue already fixed
55
/personal/lars/6.11.1.dev0@10537 # Downgrades the PT fonts to a limited unicode range, renames them, and removes copyright from css file.
66
branch/iola/event-saving-refactor-r10076 @ 10190

ietf/doc/utils.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
from ietf.doc.models import Document, DocHistory, State
1414
from ietf.doc.models import DocAlias, RelatedDocument, BallotType, DocReminder
15-
from ietf.doc.models import DocEvent, BallotDocEvent, NewRevisionDocEvent, StateDocEvent
15+
from ietf.doc.models import DocEvent, ConsensusDocEvent, BallotDocEvent, NewRevisionDocEvent, StateDocEvent
1616
from ietf.doc.models import save_document_in_history
1717
from ietf.name.models import DocReminderTypeName, DocRelationshipName
1818
from ietf.group.models import Role
@@ -321,6 +321,20 @@ def prettify_std_name(n, spacing=" "):
321321
else:
322322
return n
323323

324+
def default_consensus(doc):
325+
# if someone edits the consensus return that, otherwise
326+
# ietf stream => true and irtf stream => false
327+
consensus = None
328+
e = doc.latest_event(ConsensusDocEvent, type="changed_consensus")
329+
if (e):
330+
return e.consensus
331+
if doc.stream_id == "ietf":
332+
consensus = True
333+
elif doc.stream_id == "irtf":
334+
consensus = False
335+
else: # ise, iab, legacy
336+
return consensus
337+
324338
def nice_consensus(consensus):
325339
mapping = {
326340
None: "Unknown",

ietf/doc/views_doc.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
from ietf.doc.utils import ( add_links_in_new_revision_events, augment_events_with_revision,
5050
can_adopt_draft, get_chartering_type, get_document_content, get_tags_for_stream_id,
5151
needed_ballot_positions, nice_consensus, prettify_std_name, update_telechat, has_same_ballot,
52-
get_initial_notify, make_notify_changed_event, crawl_history)
52+
get_initial_notify, make_notify_changed_event, crawl_history, default_consensus)
5353
from ietf.community.models import CommunityList
5454
from ietf.group.models import Role
5555
from ietf.group.utils import can_manage_group_type, can_manage_materials
@@ -282,7 +282,7 @@ def document_main(request, name, rev=None):
282282
can_edit_notify = can_edit_shepherd_writeup
283283
can_edit_consensus = False
284284

285-
consensus = None
285+
consensus = nice_consensus(default_consensus(doc))
286286
if doc.stream_id == "ietf" and iesg_state:
287287
show_in_states = set(IESG_BALLOT_ACTIVE_STATES)
288288
show_in_states.update(('approved','ann','rfcqueue','pub'))

ietf/doc/views_draft.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
from ietf.doc.utils import ( add_state_change_event, can_adopt_draft,
2727
get_tags_for_stream_id, nice_consensus,
2828
update_reminder, update_telechat, make_notify_changed_event, get_initial_notify,
29-
set_replaces_for_document )
29+
set_replaces_for_document, default_consensus )
3030
from ietf.doc.lastcall import request_last_call
3131
from ietf.doc.fields import SearchableDocAliasesField
3232
from ietf.group.models import Group, Role
@@ -1103,7 +1103,7 @@ def edit_consensus(request, name):
11031103
return HttpResponseForbidden("You do not have the necessary permissions to view this page")
11041104

11051105
e = doc.latest_event(ConsensusDocEvent, type="changed_consensus")
1106-
prev_consensus = e and e.consensus
1106+
prev_consensus = e.consensus if e else default_consensus(doc)
11071107

11081108
if request.method == 'POST':
11091109
form = ConsensusForm(request.POST)
@@ -1214,8 +1214,10 @@ def request_publication(request, name):
12141214
doc=doc,
12151215
message=m,
12161216
next_state=next_state,
1217-
consensus_filled_in= ( (consensus_event != None) and (consensus_event.consensus != None) ),
1218-
),
1217+
consensus_filled_in=(
1218+
True if (doc.stream_id and doc.stream_id=='ietf')
1219+
else (consensus_event != None and consensus_event.consensus != None)),
1220+
),
12191221
context_instance = RequestContext(request))
12201222

12211223
class AdoptDraftForm(forms.Form):

0 commit comments

Comments
 (0)