Improved validaiton of status change document name
added the ability to start a status change when looking at an RFC (populating the start from accordingly) Made changes and proposed changes show on the RFC pages - Legacy-Id: 5330
This commit is contained in:
parent
589ff698ee
commit
c67661311f
|
@ -438,6 +438,7 @@ class StartStatusChangeForm(forms.Form):
|
|||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(self.__class__, self).__init__(*args, **kwargs)
|
||||
self.relations = self.initial.get('relations')
|
||||
|
||||
# telechat choices
|
||||
dates = [d.date for d in TelechatDate.objects.active().order_by('date')]
|
||||
|
@ -445,15 +446,37 @@ class StartStatusChangeForm(forms.Form):
|
|||
|
||||
def clean_document_name(self):
|
||||
name = self.cleaned_data['document_name']
|
||||
errors=[]
|
||||
if re.search("[^a-z0-9-]", name):
|
||||
errors.append("The name of the document may only contain digits, lowercase letters and dashes")
|
||||
if re.search("--", name):
|
||||
errors.append("Please do not put more than one hyphen between any two words in the name")
|
||||
if name.startswith('status-change'):
|
||||
errors.append("status-change- will be added automatically as a prefix")
|
||||
if name.startswith('-'):
|
||||
errors.append("status-change- will be added automatically as a prefix, starting with a - will result in status-change-%s"%name)
|
||||
if re.search("-[0-9]{2}$", name):
|
||||
errors.append("This name looks like ends in a version number. -00 will be added automatically. Please adjust the end of the name.")
|
||||
if Document.objects.filter(name='status-change-%s'%name):
|
||||
raise forms.ValidationError("status-change-%s already exists"%name)
|
||||
errors.append("status-change-%s already exists"%name)
|
||||
if name.endswith('CHANGETHIS'):
|
||||
errors.append("Please change CHANGETHIS to reflect the intent of this status change")
|
||||
if errors:
|
||||
raise forms.ValidationError(errors)
|
||||
return name
|
||||
|
||||
def clean_title(self):
|
||||
title = self.cleaned_data['title']
|
||||
errors=[]
|
||||
if title.endswith('CHANGETHIS'):
|
||||
errors.append("Please change CHANGETHIS to reflect the intent of this status change")
|
||||
if errors:
|
||||
raise forms.ValidationError(errors)
|
||||
return title
|
||||
|
||||
def clean(self):
|
||||
return clean_helper(self,StartStatusChangeForm)
|
||||
|
||||
#TODO - cleaned data, especially on document_name
|
||||
|
||||
def rfc_status_changes(request):
|
||||
"""Show the rfc status changes that are under consideration, and those that are completed."""
|
||||
|
||||
|
@ -466,9 +489,14 @@ def rfc_status_changes(request):
|
|||
context_instance = RequestContext(request))
|
||||
|
||||
@role_required("Area Director","Secretariat")
|
||||
def start_rfc_status_change(request):
|
||||
def start_rfc_status_change(request,name):
|
||||
"""Start the RFC status change review process, setting the initial shepherding AD, and possibly putting the review on a telechat."""
|
||||
|
||||
if name:
|
||||
if not re.match("(?i)rfc[0-9]{4}",name):
|
||||
raise Http404
|
||||
seed_rfc = get_object_or_404(Document, type="draft", docalias__name=name)
|
||||
|
||||
login = request.user.get_profile()
|
||||
|
||||
relation_slugs = DocRelationshipName.objects.filter(slug__in=RELATION_SLUGS)
|
||||
|
@ -505,8 +533,13 @@ def start_rfc_status_change(request):
|
|||
|
||||
return HttpResponseRedirect(status_change.get_absolute_url())
|
||||
else:
|
||||
init = {
|
||||
}
|
||||
init = {}
|
||||
if name:
|
||||
init['title'] = "%s to CHANGETHIS" % seed_rfc.title
|
||||
init['document_name'] = "%s-to-CHANGETHIS" % seed_rfc.canonical_name()
|
||||
relations={}
|
||||
relations[seed_rfc.canonical_name()]=None
|
||||
init['relations'] = relations
|
||||
form = StartStatusChangeForm(initial=init)
|
||||
|
||||
return render_to_response('doc/status_change/start.html',
|
||||
|
|
|
@ -405,6 +405,11 @@ class RfcWrapper:
|
|||
result['ietf_process'] = self.ietf_process.dict()
|
||||
return json.dumps(result, indent=2)
|
||||
|
||||
def underlying_document(self):
|
||||
""" Expose the Document object underneath the proxy """
|
||||
from ietf.doc.models import Document
|
||||
return Document.objects.get(docalias__name='rfc%04d'%self.rfc_number)
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
class IetfProcessData:
|
||||
|
|
|
@ -42,7 +42,7 @@ urlpatterns = patterns('',
|
|||
(r'^active/$', views_search.active),
|
||||
(r'^in-last-call/$', views_search.in_last_call),
|
||||
url(r'^rfc-status-changes/$', views_status_change.rfc_status_changes, name='rfc_status_changes'),
|
||||
url(r'^start-rfc-status-change/$', views_status_change.start_rfc_status_change, name='start_rfc_status_change'),
|
||||
url(r'^start-rfc-status-change/(?P<name>[A-Za-z0-9._+-]*)$', views_status_change.start_rfc_status_change, name='start_rfc_status_change'),
|
||||
url(r'^ad/(?P<name>[A-Za-z0-9.-]+)/$', views_search.by_ad, name="doc_search_by_ad"),
|
||||
|
||||
url(r'^(?P<name>[A-Za-z0-9._+-]+)/((?P<rev>[0-9-]+)/)?$', views_doc.document_main, name="doc_view"),
|
||||
|
|
|
@ -54,6 +54,7 @@ from ietf.doc.models import *
|
|||
from ietf.doc.utils import *
|
||||
from ietf.utils.history import find_history_active_at
|
||||
from ietf.ietfauth.decorators import has_role
|
||||
from ietf.doc.views_status_change import RELATION_SLUGS as status_change_relationships
|
||||
|
||||
def render_document_top(request, doc, tab, name):
|
||||
tabs = []
|
||||
|
@ -236,7 +237,7 @@ def document_history(request, name):
|
|||
diff_revisions = []
|
||||
seen = set()
|
||||
|
||||
diffable = name.startswith("draft") or name.startswith("charter") or name.startswith("conflict-review")
|
||||
diffable = name.startswith("draft") or name.startswith("charter") or name.startswith("conflict-review") or name.startswith("status-change")
|
||||
|
||||
if diffable:
|
||||
for e in NewRevisionDocEvent.objects.filter(type="new_revision", doc__in=diff_documents).select_related('doc').order_by("-time", "-id"):
|
||||
|
@ -250,6 +251,9 @@ def document_history(request, name):
|
|||
elif name.startswith("conflict-review"):
|
||||
h = find_history_active_at(e.doc, e.time)
|
||||
url = settings.CONFLICT_REVIEW_TXT_URL + ("%s-%s.txt" % ((h or doc).canonical_name(), e.rev))
|
||||
elif name.startswith("status-change"):
|
||||
h = find_history_active_at(e.doc, e.time)
|
||||
url = settings.STATUS_CHANGE_TXT_URL + ("%s-%s.txt" % ((h or doc).canonical_name(), e.rev))
|
||||
elif name.startswith("draft"):
|
||||
# rfcdiff tool has special support for IDs
|
||||
url = e.doc.name + "-" + e.rev
|
||||
|
@ -450,6 +454,14 @@ def document_main_rfc(request, rfc_number, tab):
|
|||
content1 = ""
|
||||
content2 = ""
|
||||
|
||||
info['status_changes'] = ', '.join([ rel.source.canonical_name() for rel in RelatedDocument.objects.filter(relationship__in=status_change_relationships,target__document=doc.underlying_document()) if rel.source.get_state_slug() in ('appr-sent','appr-pend')])
|
||||
info['proposed_status_changes'] = ', '.join([ rel.source.canonical_name() for rel in RelatedDocument.objects.filter(relationship__in=status_change_relationships,target__document=doc.underlying_document()) if rel.source.get_state_slug() in ('needshep','adrev','iesgeval','defer','appr-pr')])
|
||||
|
||||
print "DEBUGGING"
|
||||
print doc.underlying_document()
|
||||
print "status_changes",info['status_changes']
|
||||
print "proposed_status_changes",info['proposed_status_changes']
|
||||
|
||||
history = _get_history(doc, None)
|
||||
|
||||
template = "idrfc/doc_tab_%s" % tab
|
||||
|
|
|
@ -226,6 +226,7 @@ def urlize_ietf_docs(string, autoescape=None):
|
|||
string = re.sub("(?<!>)(FYI ?)0{0,3}(\d+)", "<a href=\"http://tools.ietf.org/html/fyi\\2/\">\\1\\2</a>", string)
|
||||
string = re.sub("(?<!>)(draft-[-0-9a-zA-Z._+]+)", "<a href=\"/doc/\\1/\">\\1</a>", string)
|
||||
string = re.sub("(?<!>)(conflict-review-[-0-9a-zA-Z._+]+)", "<a href=\"/doc/\\1/\">\\1</a>", string)
|
||||
string = re.sub("(?<!>)(status-change-[-0-9a-zA-Z._+]+)", "<a href=\"/doc/\\1/\">\\1</a>", string)
|
||||
return mark_safe(string)
|
||||
urlize_ietf_docs.is_safe = True
|
||||
urlize_ietf_docs.needs_autoescape = True
|
||||
|
|
|
@ -166,6 +166,14 @@ def get_doc_sectionREDESIGN(doc):
|
|||
s = "332"
|
||||
else:
|
||||
s = "331"
|
||||
elif doc.type_id == 'statchg':
|
||||
# TODO This is WRONG
|
||||
s="211"
|
||||
#protocol_action = False
|
||||
#for relation in doc.relateddocument_set.filter(relationship__in="('tops','tois','tohist','toinf','tobcp,'toexp')"):
|
||||
# if relation.relationship.slug in ('tops','tois') or relation.target.document.std_level.slug in ('std','ds','ps'):
|
||||
# protocol_action = True
|
||||
#if protocol_action:
|
||||
|
||||
return s
|
||||
|
||||
|
|
|
@ -6,6 +6,9 @@
|
|||
form.start-rfc-status-change-review #id_notify {
|
||||
width: 600px;
|
||||
}
|
||||
form.start-rfc-status-change-review #id_title {
|
||||
width: 600px;
|
||||
}
|
||||
form.start-rfc-status-change-review #id_document_name {
|
||||
width: 510px;
|
||||
}
|
||||
|
@ -29,18 +32,6 @@ form.start-rfc-status-change-review .actions {
|
|||
|
||||
<form class="start-rfc-status-change-review" action="" method="post">
|
||||
<table>
|
||||
{% for field in form.visible_fields %}
|
||||
<tr>
|
||||
<th>{{ field.label_tag }}:</th>
|
||||
<td>
|
||||
{% if field.label == "Document name" %}status-change-{% endif %}
|
||||
{{ field }}
|
||||
{% if field.help_text %}<div class="help">{{ field.help_text }}</div>{% endif %}
|
||||
|
||||
{{ field.errors }}
|
||||
</td>
|
||||
</tr>
|
||||
{% if field.label == "Document name" %}
|
||||
<tr>
|
||||
<th>Affects RFCs:</th>
|
||||
<td><table><tbody id="relations_table">
|
||||
|
@ -77,7 +68,17 @@ form.start-rfc-status-change-review .actions {
|
|||
{{ form.non_field_errors }}
|
||||
</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% for field in form.visible_fields %}
|
||||
<tr>
|
||||
<th>{{ field.label_tag }}:</th>
|
||||
<td>
|
||||
{% if field.label == "Document name" %}status-change-{% endif %}
|
||||
{{ field }}
|
||||
{% if field.help_text %}<div class="help">{{ field.help_text }}</div>{% endif %}
|
||||
|
||||
{{ field.errors }}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
<tr>
|
||||
<td colspan="2" class="actions">
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<h1>RFC Status Changes</h1>
|
||||
|
||||
{% if user|in_group:"Area_Director,Secretariat" %}
|
||||
<p><a href="{% url start_rfc_status_change %}">Start new RFC status change document</a></p>
|
||||
<p><a href="{% url start_rfc_status_change name='' %}">Start new RFC status change document</a></p>
|
||||
{% endif %}
|
||||
{% regroup docs by get_state as state_groups %}
|
||||
<table class="ietf-table ietf-doctable">
|
||||
|
|
|
@ -47,29 +47,32 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
{% block doc_metabuttons %}
|
||||
{% if user|in_group:"Area_Director,Secretariat" %}
|
||||
<div style="padding-bottom:2px;">
|
||||
{% ifequal doc.draft_status "Expired" %}
|
||||
{% if not doc.resurrect_requested_by %}
|
||||
<span id="doc_request_resurrect_button" class="yui-button yui-link-button" style="margin-left:2px;"><span class="first-child"><a href="{% url doc_request_resurrect name=doc.draft_name %}">Request resurrect</a></span></span>
|
||||
{% endif %}
|
||||
{% if user|in_group:"Secretariat" %}
|
||||
<span id="doc_resurrect_button" class="yui-button yui-link-button" style="margin-left:2px;"><span class="first-child"><a href="{% url doc_resurrect name=doc.draft_name %}">Resurrect</a></span></span>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
{% if stream_info.stream.name == 'ISE' or stream_info.stream.name == 'IRTF' %}
|
||||
{% if user|in_group:"Secretariat" and not info.conflict_reviews %}
|
||||
<span id="doc_conflict_review_button" class="yui-button yui-link-button" style="margin-left:2px;">{% url conflict_review_start name=doc.draft_name as start_review_url %}{% if start_review_url %}<span class="first-child"><a href="{{start_review_url}}">Begin IETF Conflict Review {% if not doc.underlying_document.intended_std_level %}(note that intended status is not set){% endif %}</a></span>{% endif %}</span>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
{% if stream_info.stream.name == 'IETF'%}{%if not doc.in_ietf_process %}
|
||||
<span id="doc_add_button" class="yui-button yui-link-button" style="margin-left:2px;">{% url doc_edit_info name=doc.draft_name as doc_edit_url %}{% if doc_edit_url %}<span class="first-child"><a href="{{doc_edit_url}}">Begin IESG Processing</a></span>{% endif %}</span>
|
||||
{% endif %}{% endif %}
|
||||
{% endif %}
|
||||
{% endifequal %}
|
||||
|
||||
</div>
|
||||
<div style="padding-bottom:2px;">
|
||||
{% ifequal doc.draft_status "Expired" %}
|
||||
{% if not doc.resurrect_requested_by and user|in_group:"Area_Director" %}
|
||||
<span id="doc_request_resurrect_button" class="yui-button yui-link-button" style="margin-left:2px;"><span class="first-child"><a href="{% url doc_request_resurrect name=doc.draft_name %}">Request resurrect</a></span></span>
|
||||
{% endif %}
|
||||
{% if user|in_group:"Secretariat" %}
|
||||
<span id="doc_resurrect_button" class="yui-button yui-link-button" style="margin-left:2px;"><span class="first-child"><a href="{% url doc_resurrect name=doc.draft_name %}">Resurrect</a></span></span>
|
||||
{% endif %}
|
||||
{% else %} {# not expired #}
|
||||
{% if stream_info.stream.name == 'ISE' or stream_info.stream.name == 'IRTF' %}
|
||||
{% if user|in_group:"Secretariat" and not info.conflict_reviews %}
|
||||
<span id="doc_conflict_review_button" class="yui-button yui-link-button" style="margin-left:2px;">{% url conflict_review_start name=doc.draft_name as start_review_url %}{% if start_review_url %}<span class="first-child"><a href="{{start_review_url}}">Begin IETF Conflict Review {% if not doc.underlying_document.intended_std_level %}(note that intended status is not set){% endif %}</a></span>{% endif %}</span>
|
||||
{% endif %}
|
||||
{% else %} {# Not a candidate for conflict review #}
|
||||
{% if stream_info.stream.name == 'IETF' and not doc.in_ietf_process %}
|
||||
<span id="doc_add_button" class="yui-button yui-link-button" style="margin-left:2px;">{% url doc_edit_info name=doc.draft_name as doc_edit_url %}{% if doc_edit_url %}<span class="first-child"><a href="{{doc_edit_url}}">Begin IESG Processing</a></span>{% endif %}</span>
|
||||
{% else %}
|
||||
{% if doc.underlying_document.get_state_slug == 'rfc' %}
|
||||
<span id="doc_start_status_change" class="yui-button yui-link-button" style="margin-left:2px;">{% url start_rfc_status_change name=doc.underlying_document.canonical_name as start_url %}{% if start_url %}<span class="first-child"><a href="{{start_url}}">Start {% if info.proposed_status_changes %}An Additional {% endif %}Status Change</a></span>{% endif %}</span>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endifequal %}
|
||||
</div>
|
||||
{% endif %}{# if user in group #}
|
||||
{% endblock doc_metabuttons%}
|
||||
{% endblock doc_metabuttons %}
|
||||
</div> <!-- metabox -->
|
||||
|
||||
<div id="rfcText1">
|
||||
|
|
|
@ -41,6 +41,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
{% if doc.updated_by %}<br />Updated by {{ doc.updated_by|urlize_ietf_docs }}{%endif %}
|
||||
{% if doc.obsoletes %}<br />Obsoletes {{ doc.obsoletes|urlize_ietf_docs }}{%endif %}
|
||||
{% if doc.updates %}<br />Updates {{ doc.updates|urlize_ietf_docs }}{%endif %}
|
||||
{% if info.status_changes %}<br />Status changed by {{ info.status_changes|urlize_ietf_docs }}{% endif %}
|
||||
{% if info.proposed_status_changes %}<br />Proposed status changes by {{ info.proposed_status_changes|urlize_ietf_docs }}{% endif %}
|
||||
{% if doc.also %}<br />Also Known As {{ doc.also|urlize_ietf_docs }}{%endif %}
|
||||
{% if doc.draft_name %}<br />Was <a href="/doc/{{ doc.draft_name}}/">{{doc.draft_name}}</a>{% endif %}
|
||||
{% if doc.has_errata %}<br /><a href="http://www.rfc-editor.org/errata_search.php?rfc={{doc.rfc_number}}" rel="nofollow">Errata</a>{% endif %}
|
||||
|
|
Loading…
Reference in a new issue