Skip to content

Commit c93a310

Browse files
committed
assigned default consensus for IETF stream documents partly fixing ietf-tools#1403 - IRTF/IAB may want more, this just does IETF stream. Commit ready to merge.
- Legacy-Id: 11073
1 parent 9f90441 commit c93a310

5 files changed

Lines changed: 4719 additions & 11 deletions

File tree

ietf/doc/utils.py

Lines changed: 14 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,19 @@ 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+
return consensus
336+
324337
def nice_consensus(consensus):
325338
mapping = {
326339
None: "Unknown",

ietf/doc/views_doc.py

Lines changed: 3 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,8 @@ 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 = default_consensus(doc)
286+
consensus = nice_consensus(consensus)
286287
if doc.stream_id == "ietf" and iesg_state:
287288
show_in_states = set(IESG_BALLOT_ACTIVE_STATES)
288289
show_in_states.update(('approved','ann','rfcqueue','pub'))

ietf/doc/views_draft.py

Lines changed: 8 additions & 3 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
@@ -1104,6 +1104,10 @@ def edit_consensus(request, name):
11041104

11051105
e = doc.latest_event(ConsensusDocEvent, type="changed_consensus")
11061106
prev_consensus = e and e.consensus
1107+
if (not e):
1108+
prev_consensus=default_consensus(doc)
1109+
else:
1110+
prev_consensus = e and e.consensus
11071111

11081112
if request.method == 'POST':
11091113
form = ConsensusForm(request.POST)
@@ -1143,7 +1147,7 @@ def request_publication(request, name):
11431147
if not is_authorized_in_doc_stream(request.user, doc):
11441148
return HttpResponseForbidden("You do not have the necessary permissions to view this page")
11451149

1146-
consensus_event = doc.latest_event(ConsensusDocEvent, type="changed_consensus")
1150+
# consensus_event = doc.latest_event(ConsensusDocEvent, type="changed_consensus")
11471151

11481152
m = Message()
11491153
m.frm = request.user.person.formatted_email()
@@ -1214,7 +1218,8 @@ def request_publication(request, name):
12141218
doc=doc,
12151219
message=m,
12161220
next_state=next_state,
1217-
consensus_filled_in= ( (consensus_event != None) and (consensus_event.consensus != None) ),
1221+
# consensus_filled_in= ( (consensus_event != None) and (consensus_event.consensus != None) ),
1222+
consensus_filled_in= ( True )
12181223
),
12191224
context_instance = RequestContext(request))
12201225

0 commit comments

Comments
 (0)