In order that document states (which may be used by old documents) should not need to be removed when state machines change and states go out of use, all document states have a 'used' field. The code which accesses the state fields have not been requiring that used=True for the states returned, which is an error. Fixed this by adding 'used=True' to all State.objects.get() and State.objects.filter() call where it's relevant.
- Legacy-Id: 5486
This commit is contained in:
commit
2f3476690f
|
@ -42,7 +42,7 @@ class StatesWidget(forms.SelectMultiple):
|
|||
|
||||
categorized_choices = []
|
||||
for t in types:
|
||||
states = State.objects.filter(type=t).select_related()
|
||||
states = State.objects.filter(used=True, type=t).select_related()
|
||||
if states:
|
||||
categorized_choices.append((t.label, states))
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@ class ConflictReviewTestCase(django.test.TestCase):
|
|||
|
||||
# successful review start
|
||||
ad_strpk = str(Person.objects.get(name='Aread Irector').pk)
|
||||
state_strpk = str(State.objects.get(slug='needshep',type__slug='conflrev').pk)
|
||||
state_strpk = str(State.objects.get(used=True, slug='needshep',type__slug='conflrev').pk)
|
||||
r = self.client.post(url,dict(ad=ad_strpk,create_in_state=state_strpk,notify='ipu@ietf.org'))
|
||||
self.assertEquals(r.status_code, 302)
|
||||
review_doc = Document.objects.get(name='conflict-review-imaginary-independent-submission')
|
||||
|
@ -99,7 +99,7 @@ class ConflictReviewTestCase(django.test.TestCase):
|
|||
self.assertTrue(len(q('form ul.errorlist')) > 0)
|
||||
|
||||
# successful change to AD Review
|
||||
adrev_pk = str(State.objects.get(slug='adrev',type__slug='conflrev').pk)
|
||||
adrev_pk = str(State.objects.get(used=True, slug='adrev',type__slug='conflrev').pk)
|
||||
r = self.client.post(url,dict(review_state=adrev_pk,comment='RDNK84ZD'))
|
||||
self.assertEquals(r.status_code, 302)
|
||||
review_doc = Document.objects.get(name='conflict-review-imaginary-irtf-submission')
|
||||
|
@ -108,7 +108,7 @@ class ConflictReviewTestCase(django.test.TestCase):
|
|||
self.assertFalse(review_doc.active_ballot())
|
||||
|
||||
# successful change to IESG Evaluation
|
||||
iesgeval_pk = str(State.objects.get(slug='iesgeval',type__slug='conflrev').pk)
|
||||
iesgeval_pk = str(State.objects.get(used=True, slug='iesgeval',type__slug='conflrev').pk)
|
||||
r = self.client.post(url,dict(review_state=iesgeval_pk,comment='TGmZtEjt'))
|
||||
self.assertEquals(r.status_code, 302)
|
||||
review_doc = Document.objects.get(name='conflict-review-imaginary-irtf-submission')
|
||||
|
@ -214,7 +214,7 @@ class ConflictReviewTestCase(django.test.TestCase):
|
|||
|
||||
# Some additional setup
|
||||
create_ballot_if_not_open(doc,Person.objects.get(name="Sec Retary"),"conflrev")
|
||||
doc.set_state(State.objects.get(slug=approve_type+'-pend',type='conflrev'))
|
||||
doc.set_state(State.objects.get(used=True, slug=approve_type+'-pend',type='conflrev'))
|
||||
doc.save()
|
||||
|
||||
# get
|
||||
|
|
|
@ -26,7 +26,7 @@ from ietf.iesg.models import TelechatDate
|
|||
from ietf.group.models import Role, Group
|
||||
|
||||
class ChangeStateForm(forms.Form):
|
||||
review_state = forms.ModelChoiceField(State.objects.filter(type="conflrev", used=True), label="Conflict review state", empty_label=None, required=True)
|
||||
review_state = forms.ModelChoiceField(State.objects.filter(used=True, type="conflrev"), label="Conflict review state", empty_label=None, required=True)
|
||||
comment = forms.CharField(widget=forms.Textarea, help_text="Optional comment for the review history", required=False)
|
||||
def __init__(self, *args, **kwargs):
|
||||
self.hide = kwargs.pop('hide', None)
|
||||
|
@ -329,7 +329,7 @@ def approve(request, name):
|
|||
if form.is_valid():
|
||||
|
||||
new_state_slug = 'appr-reqnopub-sent' if review.get_state('conflrev').slug=='appr-reqnopub-pend' else 'appr-noprob-sent'
|
||||
new_review_state = State.objects.get(type="conflrev", slug=new_state_slug)
|
||||
new_review_state = State.objects.get(used=True, type="conflrev", slug=new_state_slug)
|
||||
save_document_in_history(review)
|
||||
old_description = review.friendly_state()
|
||||
review.set_state(new_review_state)
|
||||
|
@ -372,7 +372,7 @@ def approve(request, name):
|
|||
class StartReviewForm(forms.Form):
|
||||
ad = forms.ModelChoiceField(Person.objects.filter(role__name="ad", role__group__state="active").order_by('name'),
|
||||
label="Shepherding AD", empty_label="(None)", required=True)
|
||||
create_in_state = forms.ModelChoiceField(State.objects.filter(type="conflrev", slug__in=("needshep", "adrev")), empty_label=None, required=False)
|
||||
create_in_state = forms.ModelChoiceField(State.objects.filter(used=True, type="conflrev", slug__in=("needshep", "adrev")), empty_label=None, required=False)
|
||||
notify = forms.CharField(max_length=255, label="Notice emails", help_text="Separate email addresses with commas", required=False)
|
||||
telechat_date = forms.TypedChoiceField(coerce=lambda x: datetime.datetime.strptime(x, '%Y-%m-%d').date(), empty_value=None, required=False, widget=forms.Select(attrs={'onchange':'make_bold()'}))
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ def state(request, doc, type=None):
|
|||
slug = "%s-%s" % (doc,type) if type else doc
|
||||
debug.show('slug')
|
||||
statetype = get_object_or_404(StateType, slug=slug)
|
||||
states = State.objects.filter(type=statetype).order_by('order')
|
||||
states = State.objects.filter(used=True, type=statetype).order_by('order')
|
||||
return render_to_response('help/states.html', {"doc": doc, "type": statetype, "states":states},
|
||||
context_instance=RequestContext(request))
|
||||
|
||||
|
|
|
@ -41,10 +41,10 @@ def expirable_documents():
|
|||
|
||||
nonexpirable_states = []
|
||||
# all IESG states except AD Watching and Dead block expiry
|
||||
nonexpirable_states += list(State.objects.filter(type="draft-iesg").exclude(slug__in=("watching", "dead")))
|
||||
nonexpirable_states += list(State.objects.filter(used=True, type="draft-iesg").exclude(slug__in=("watching", "dead")))
|
||||
# Sent to RFC Editor and RFC Published block expiry (the latter
|
||||
# shouldn't be possible for an active draft, though)
|
||||
nonexpirable_states += list(State.objects.filter(type__in=("draft-stream-iab", "draft-stream-irtf", "draft-stream-ise"), slug__in=("rfc-edit", "pub")))
|
||||
nonexpirable_states += list(State.objects.filter(used=True, type__in=("draft-stream-iab", "draft-stream-irtf", "draft-stream-ise"), slug__in=("rfc-edit", "pub")))
|
||||
|
||||
return d.exclude(states__in=nonexpirable_states).distinct()
|
||||
|
||||
|
@ -220,7 +220,7 @@ def expire_idREDESIGN(doc):
|
|||
|
||||
save_document_in_history(doc)
|
||||
if doc.latest_event(type='started_iesg_process'):
|
||||
dead_state = State.objects.get(type="draft-iesg", slug="dead")
|
||||
dead_state = State.objects.get(used=True, type="draft-iesg", slug="dead")
|
||||
prev = doc.get_state("draft-iesg")
|
||||
prev_tag = doc.tags.filter(slug__in=('point', 'ad-f-up', 'need-rev', 'extpty'))
|
||||
prev_tag = prev_tag[0] if prev_tag else None
|
||||
|
@ -235,7 +235,7 @@ def expire_idREDESIGN(doc):
|
|||
e.desc = "Document has expired"
|
||||
e.save()
|
||||
|
||||
doc.set_state(State.objects.get(type="draft", slug="expired"))
|
||||
doc.set_state(State.objects.get(used=True, type="draft", slug="expired"))
|
||||
doc.time = datetime.datetime.now()
|
||||
doc.save()
|
||||
|
||||
|
|
|
@ -70,13 +70,13 @@ def expire_last_call(doc):
|
|||
email_last_call_expired(doc)
|
||||
|
||||
def expire_last_callREDESIGN(doc):
|
||||
state = State.objects.get(type="draft-iesg", slug="writeupw")
|
||||
state = State.objects.get(used=True, type="draft-iesg", slug="writeupw")
|
||||
|
||||
e = doc.latest_event(WriteupDocEvent, type="changed_ballot_writeup_text")
|
||||
if e and "What does this protocol do and why" not in e.text:
|
||||
# if boiler-plate text has been removed, we assume the
|
||||
# write-up has been written
|
||||
state = State.objects.get(type="draft-iesg", slug="goaheadw")
|
||||
state = State.objects.get(used=True, type="draft-iesg", slug="goaheadw")
|
||||
|
||||
save_document_in_history(doc)
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ class ChangeStateTestCase(django.test.TestCase):
|
|||
|
||||
def test_change_state(self):
|
||||
draft = make_test_data()
|
||||
draft.set_state(State.objects.get(type="draft-iesg", slug="ad-eval"))
|
||||
draft.set_state(State.objects.get(used=True, type="draft-iesg", slug="ad-eval"))
|
||||
|
||||
url = urlreverse('doc_change_state', kwargs=dict(name=draft.name))
|
||||
login_testing_unauthorized(self, "secretary", url)
|
||||
|
@ -82,7 +82,7 @@ class ChangeStateTestCase(django.test.TestCase):
|
|||
|
||||
|
||||
# faulty post
|
||||
r = self.client.post(url, dict(state=State.objects.get(type="draft", slug="active").pk))
|
||||
r = self.client.post(url, dict(state=State.objects.get(used=True, type="draft", slug="active").pk))
|
||||
self.assertEquals(r.status_code, 200)
|
||||
q = PyQuery(r.content)
|
||||
self.assertTrue(len(q('form ul.errorlist')) > 0)
|
||||
|
@ -96,7 +96,7 @@ class ChangeStateTestCase(django.test.TestCase):
|
|||
draft.tags.add("ad-f-up")
|
||||
|
||||
r = self.client.post(url,
|
||||
dict(state=State.objects.get(type="draft-iesg", slug="review-e").pk,
|
||||
dict(state=State.objects.get(used=True, type="draft-iesg", slug="review-e").pk,
|
||||
substate="point",
|
||||
comment="Test comment"))
|
||||
self.assertEquals(r.status_code, 302)
|
||||
|
@ -121,7 +121,7 @@ class ChangeStateTestCase(django.test.TestCase):
|
|||
|
||||
def test_pull_from_rfc_queue(self):
|
||||
draft = make_test_data()
|
||||
draft.set_state(State.objects.get(type="draft-iesg", slug="rfcqueue"))
|
||||
draft.set_state(State.objects.get(used=True, type="draft-iesg", slug="rfcqueue"))
|
||||
|
||||
url = urlreverse('doc_change_state', kwargs=dict(name=draft.name))
|
||||
login_testing_unauthorized(self, "secretary", url)
|
||||
|
@ -130,7 +130,7 @@ class ChangeStateTestCase(django.test.TestCase):
|
|||
mailbox_before = len(outbox)
|
||||
|
||||
r = self.client.post(url,
|
||||
dict(state=State.objects.get(type="draft-iesg", slug="review-e").pk,
|
||||
dict(state=State.objects.get(used=True, type="draft-iesg", slug="review-e").pk,
|
||||
substate="",
|
||||
comment="Test comment"))
|
||||
self.assertEquals(r.status_code, 302)
|
||||
|
@ -146,8 +146,8 @@ class ChangeStateTestCase(django.test.TestCase):
|
|||
def test_change_iana_state(self):
|
||||
draft = make_test_data()
|
||||
|
||||
first_state = State.objects.get(type="draft-iana-review", slug="need-rev")
|
||||
next_state = State.objects.get(type="draft-iana-review", slug="ok-noact")
|
||||
first_state = State.objects.get(used=True, type="draft-iana-review", slug="need-rev")
|
||||
next_state = State.objects.get(used=True, type="draft-iana-review", slug="ok-noact")
|
||||
draft.set_state(first_state)
|
||||
|
||||
url = urlreverse('doc_change_iana_state', kwargs=dict(name=draft.name, state_type="iana-review"))
|
||||
|
@ -176,7 +176,7 @@ class ChangeStateTestCase(django.test.TestCase):
|
|||
|
||||
def test_request_last_call(self):
|
||||
draft = make_test_data()
|
||||
draft.set_state(State.objects.get(type="draft-iesg", slug="ad-eval"))
|
||||
draft.set_state(State.objects.get(used=True, type="draft-iesg", slug="ad-eval"))
|
||||
|
||||
self.client.login(remote_user="secretary")
|
||||
url = urlreverse('doc_change_state', kwargs=dict(name=draft.name))
|
||||
|
@ -184,7 +184,7 @@ class ChangeStateTestCase(django.test.TestCase):
|
|||
mailbox_before = len(outbox)
|
||||
|
||||
self.assertTrue(not draft.latest_event(type="changed_ballot_writeup_text"))
|
||||
r = self.client.post(url, dict(state=State.objects.get(type="draft-iesg", slug="lc-req").pk))
|
||||
r = self.client.post(url, dict(state=State.objects.get(used=True, type="draft-iesg", slug="lc-req").pk))
|
||||
self.assertContains(r, "Your request to issue the Last Call")
|
||||
|
||||
# last call text
|
||||
|
@ -348,7 +348,7 @@ class EditInfoTestCase(django.test.TestCase):
|
|||
r = self.client.post(url,
|
||||
dict(intended_std_level=str(draft.intended_std_level_id),
|
||||
ad=ad.pk,
|
||||
create_in_state=State.objects.get(type="draft-iesg", slug="watching").pk,
|
||||
create_in_state=State.objects.get(used=True, type="draft-iesg", slug="watching").pk,
|
||||
notify="test@example.com",
|
||||
note="This is a note",
|
||||
telechat_date="",
|
||||
|
@ -383,7 +383,7 @@ class ResurrectTestCase(django.test.TestCase):
|
|||
|
||||
def test_request_resurrect(self):
|
||||
draft = make_test_data()
|
||||
draft.set_state(State.objects.get(type="draft", slug="expired"))
|
||||
draft.set_state(State.objects.get(used=True, type="draft", slug="expired"))
|
||||
|
||||
url = urlreverse('doc_request_resurrect', kwargs=dict(name=draft.name))
|
||||
|
||||
|
@ -414,7 +414,7 @@ class ResurrectTestCase(django.test.TestCase):
|
|||
|
||||
def test_resurrect(self):
|
||||
draft = make_test_data()
|
||||
draft.set_state(State.objects.get(type="draft", slug="expired"))
|
||||
draft.set_state(State.objects.get(used=True, type="draft", slug="expired"))
|
||||
|
||||
DocEvent.objects.create(doc=draft,
|
||||
type="requested_resurrect",
|
||||
|
@ -636,7 +636,7 @@ class DeferBallotTestCase(django.test.TestCase):
|
|||
|
||||
def test_defer_ballot(self):
|
||||
draft = make_test_data()
|
||||
draft.set_state(State.objects.get(type="draft-iesg", slug="iesg-eva"))
|
||||
draft.set_state(State.objects.get(used=True, type="draft-iesg", slug="iesg-eva"))
|
||||
|
||||
url = urlreverse('doc_defer_ballot', kwargs=dict(name=draft.name))
|
||||
login_testing_unauthorized(self, "ad", url)
|
||||
|
@ -661,7 +661,7 @@ class DeferBallotTestCase(django.test.TestCase):
|
|||
|
||||
def test_undefer_ballot(self):
|
||||
draft = make_test_data()
|
||||
draft.set_state(State.objects.get(type="draft-iesg", slug="defer"))
|
||||
draft.set_state(State.objects.get(used=True, type="draft-iesg", slug="defer"))
|
||||
|
||||
url = urlreverse('doc_undefer_ballot', kwargs=dict(name=draft.name))
|
||||
login_testing_unauthorized(self, "ad", url)
|
||||
|
@ -747,7 +747,7 @@ class BallotWriteupsTestCase(django.test.TestCase):
|
|||
login_testing_unauthorized(self, "secretary", url)
|
||||
|
||||
# add a IANA review note
|
||||
draft.set_state(State.objects.get(type="draft-iana-review", slug="not-ok"))
|
||||
draft.set_state(State.objects.get(used=True, type="draft-iana-review", slug="not-ok"))
|
||||
DocEvent.objects.create(type="iana_review",
|
||||
doc=draft,
|
||||
by=Person.objects.get(user__username="iana"),
|
||||
|
@ -850,7 +850,7 @@ class BallotWriteupsTestCase(django.test.TestCase):
|
|||
self.assertTrue("Subject: Protocol Action" in draft.latest_event(WriteupDocEvent, type="changed_ballot_approval_text").text)
|
||||
|
||||
# test regenerate when it's a disapprove
|
||||
draft.set_state(State.objects.get(type="draft-iesg", slug="nopubadw"))
|
||||
draft.set_state(State.objects.get(used=True, type="draft-iesg", slug="nopubadw"))
|
||||
|
||||
r = self.client.post(url, dict(regenerate_approval_text="1"))
|
||||
self.assertEquals(r.status_code, 200)
|
||||
|
@ -861,7 +861,7 @@ class BallotWriteupsTestCase(django.test.TestCase):
|
|||
draft.group = Group.objects.get(type="individ")
|
||||
draft.stream_id = "irtf"
|
||||
draft.save()
|
||||
draft.set_state(State.objects.get(type="draft-iesg", slug="iesg-eva"))
|
||||
draft.set_state(State.objects.get(used=True, type="draft-iesg", slug="iesg-eva"))
|
||||
|
||||
r = self.client.post(url, dict(regenerate_approval_text="1"))
|
||||
self.assertEquals(r.status_code, 200)
|
||||
|
@ -873,7 +873,7 @@ class ApproveBallotTestCase(django.test.TestCase):
|
|||
|
||||
def test_approve_ballot(self):
|
||||
draft = make_test_data()
|
||||
draft.set_state(State.objects.get(type="draft-iesg", slug="iesg-eva")) # make sure it's approvable
|
||||
draft.set_state(State.objects.get(used=True, type="draft-iesg", slug="iesg-eva")) # make sure it's approvable
|
||||
|
||||
url = urlreverse('doc_approve_ballot', kwargs=dict(name=draft.name))
|
||||
login_testing_unauthorized(self, "secretary", url)
|
||||
|
@ -901,7 +901,7 @@ class ApproveBallotTestCase(django.test.TestCase):
|
|||
|
||||
def test_disapprove_ballot(self):
|
||||
draft = make_test_data()
|
||||
draft.set_state(State.objects.get(type="draft-iesg", slug="nopubadw"))
|
||||
draft.set_state(State.objects.get(used=True, type="draft-iesg", slug="nopubadw"))
|
||||
|
||||
url = urlreverse('doc_approve_ballot', kwargs=dict(name=draft.name))
|
||||
login_testing_unauthorized(self, "secretary", url)
|
||||
|
@ -922,7 +922,7 @@ class MakeLastCallTestCase(django.test.TestCase):
|
|||
|
||||
def test_make_last_call(self):
|
||||
draft = make_test_data()
|
||||
draft.set_state(State.objects.get(type="draft-iesg", slug="lc-req"))
|
||||
draft.set_state(State.objects.get(used=True, type="draft-iesg", slug="lc-req"))
|
||||
|
||||
url = urlreverse('doc_make_last_call', kwargs=dict(name=draft.name))
|
||||
login_testing_unauthorized(self, "secretary", url)
|
||||
|
@ -963,7 +963,7 @@ class RequestPublicationTestCase(django.test.TestCase):
|
|||
draft.group = Group.objects.get(acronym="iab")
|
||||
draft.intended_std_level = IntendedStdLevelName.objects.get(slug="inf")
|
||||
draft.save()
|
||||
draft.set_state(State.objects.get(type="draft-stream-iab", slug="approved"))
|
||||
draft.set_state(State.objects.get(used=True, type="draft-stream-iab", slug="approved"))
|
||||
|
||||
url = urlreverse('doc_request_publication', kwargs=dict(name=draft.name))
|
||||
login_testing_unauthorized(self, "iabchair", url)
|
||||
|
@ -1068,11 +1068,11 @@ class ExpireIDsTestCase(django.test.TestCase):
|
|||
|
||||
self.assertEquals(len(list(get_expired_ids())), 1)
|
||||
|
||||
draft.set_state(State.objects.get(type="draft-iesg", slug="watching"))
|
||||
draft.set_state(State.objects.get(used=True, type="draft-iesg", slug="watching"))
|
||||
|
||||
self.assertEquals(len(list(get_expired_ids())), 1)
|
||||
|
||||
draft.set_state(State.objects.get(type="draft-iesg", slug="iesg-eva"))
|
||||
draft.set_state(State.objects.get(used=True, type="draft-iesg", slug="iesg-eva"))
|
||||
|
||||
self.assertEquals(len(list(get_expired_ids())), 0)
|
||||
|
||||
|
@ -1123,7 +1123,7 @@ class ExpireIDsTestCase(django.test.TestCase):
|
|||
|
||||
|
||||
# RFC draft
|
||||
draft.set_state(State.objects.get(type="draft", slug="rfc"))
|
||||
draft.set_state(State.objects.get(used=True, type="draft", slug="rfc"))
|
||||
draft.save()
|
||||
|
||||
txt = "%s-%s.txt" % (draft.name, draft.rev)
|
||||
|
@ -1141,7 +1141,7 @@ class ExpireIDsTestCase(django.test.TestCase):
|
|||
|
||||
|
||||
# expire draft
|
||||
draft.set_state(State.objects.get(type="draft", slug="expired"))
|
||||
draft.set_state(State.objects.get(used=True, type="draft", slug="expired"))
|
||||
draft.expires = datetime.datetime.now() - datetime.timedelta(days=1)
|
||||
draft.save()
|
||||
|
||||
|
@ -1183,7 +1183,7 @@ class ExpireLastCallTestCase(django.test.TestCase):
|
|||
# check that non-expirable drafts aren't expired
|
||||
|
||||
draft = make_test_data()
|
||||
draft.set_state(State.objects.get(type="draft-iesg", slug="lc"))
|
||||
draft.set_state(State.objects.get(used=True, type="draft-iesg", slug="lc"))
|
||||
|
||||
secretary = Person.objects.get(name="Sec Retary")
|
||||
|
||||
|
|
|
@ -84,8 +84,8 @@ urlpatterns = patterns('',
|
|||
)
|
||||
|
||||
urlpatterns += patterns('django.views.generic.simple',
|
||||
url(r'^help/state/charter/$', 'direct_to_template', { 'template': 'doc/states.html', 'extra_context': { 'states': State.objects.filter(type="charter"),'title':"Charter" } }, name='help_charter_states'),
|
||||
url(r'^help/state/conflict-review/$', 'direct_to_template', { 'template': 'doc/states.html', 'extra_context': { 'states': State.objects.filter(type="conflrev").order_by("order"),'title':"Conflict Review" } }, name='help_conflict_review_states'),
|
||||
url(r'^help/state/charter/$', 'direct_to_template', { 'template': 'doc/states.html', 'extra_context': { 'states': State.objects.filter(used=True, type="charter"),'title':"Charter" } }, name='help_charter_states'),
|
||||
url(r'^help/state/conflict-review/$', 'direct_to_template', { 'template': 'doc/states.html', 'extra_context': { 'states': State.objects.filter(used=True, type="conflrev").order_by("order"),'title':"Conflict Review" } }, name='help_conflict_review_states'),
|
||||
)
|
||||
|
||||
|
||||
|
|
|
@ -420,13 +420,13 @@ def defer_ballotREDESIGN(request, name):
|
|||
|
||||
prev_state = doc.friendly_state()
|
||||
if doc.type_id == 'draft':
|
||||
doc.set_state(State.objects.get(type="draft-iesg", slug='defer'))
|
||||
doc.set_state(State.objects.get(used=True, type="draft-iesg", slug='defer'))
|
||||
prev_tag = doc.tags.filter(slug__in=('point', 'ad-f-up', 'need-rev', 'extpty'))
|
||||
prev_tag = prev_tag[0] if prev_tag else None
|
||||
if prev_tag:
|
||||
doc.tags.remove(prev_tag)
|
||||
elif doc.type_id == 'conflrev':
|
||||
doc.set_state(State.objects.get(type='conflrev', slug='defer'))
|
||||
doc.set_state(State.objects.get(used=True, type='conflrev', slug='defer'))
|
||||
|
||||
e = docutil_log_state_changed(request, doc, login, doc.friendly_state(), prev_state)
|
||||
|
||||
|
@ -470,13 +470,13 @@ def undefer_ballotREDESIGN(request, name):
|
|||
|
||||
prev_state = doc.friendly_state()
|
||||
if doc.type_id == 'draft':
|
||||
doc.set_state(State.objects.get(type="draft-iesg", slug='iesg-eva'))
|
||||
doc.set_state(State.objects.get(used=True, type="draft-iesg", slug='iesg-eva'))
|
||||
prev_tag = doc.tags.filter(slug__in=('point', 'ad-f-up', 'need-rev', 'extpty'))
|
||||
prev_tag = prev_tag[0] if prev_tag else None
|
||||
if prev_tag:
|
||||
doc.tags.remove(prev_tag)
|
||||
elif doc.type_id == 'conflrev':
|
||||
doc.set_state(State.objects.get(type='conflrev',slug='iesgeval'))
|
||||
doc.set_state(State.objects.get(used=True, type='conflrev',slug='iesgeval'))
|
||||
|
||||
e = docutil_log_state_changed(request, doc, login, doc.friendly_state(), prev_state)
|
||||
|
||||
|
@ -628,7 +628,7 @@ def lastcalltextREDESIGN(request, name):
|
|||
save_document_in_history(doc)
|
||||
|
||||
prev = doc.get_state("draft-iesg")
|
||||
doc.set_state(State.objects.get(type="draft-iesg", slug='lc-req'))
|
||||
doc.set_state(State.objects.get(used=True, type="draft-iesg", slug='lc-req'))
|
||||
|
||||
prev_tag = doc.tags.filter(slug__in=('point', 'ad-f-up', 'need-rev', 'extpty'))
|
||||
prev_tag = prev_tag[0] if prev_tag else None
|
||||
|
@ -1001,9 +1001,9 @@ def approve_ballotREDESIGN(request, name):
|
|||
|
||||
if request.method == 'POST':
|
||||
if action == "do_not_publish":
|
||||
new_state = State.objects.get(type="draft-iesg", slug="dead")
|
||||
new_state = State.objects.get(used=True, type="draft-iesg", slug="dead")
|
||||
else:
|
||||
new_state = State.objects.get(type="draft-iesg", slug="ann")
|
||||
new_state = State.objects.get(used=True, type="draft-iesg", slug="ann")
|
||||
|
||||
# fixup document
|
||||
close_open_ballots(doc, login)
|
||||
|
@ -1096,7 +1096,7 @@ def make_last_call(request, name):
|
|||
save_document_in_history(doc)
|
||||
|
||||
prev = doc.get_state("draft-iesg")
|
||||
doc.set_state(State.objects.get(type="draft-iesg", slug='lc'))
|
||||
doc.set_state(State.objects.get(used=True, type="draft-iesg", slug='lc'))
|
||||
|
||||
prev_tag = doc.tags.filter(slug__in=('point', 'ad-f-up', 'need-rev', 'extpty'))
|
||||
prev_tag = prev_tag[0] if prev_tag else None
|
||||
|
@ -1125,7 +1125,7 @@ def make_last_call(request, name):
|
|||
# update IANA Review state
|
||||
prev_state = doc.get_state("draft-iana-review")
|
||||
if not prev_state:
|
||||
next_state = State.objects.get(type="draft-iana-review", slug="need-rev")
|
||||
next_state = State.objects.get(used=True, type="draft-iana-review", slug="need-rev")
|
||||
doc.set_state(next_state)
|
||||
add_state_change_event(doc, login, prev_state, next_state)
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ def change_state(request, name):
|
|||
IESG_SUBSTATE_TAGS = ('point', 'ad-f-up', 'need-rev', 'extpty')
|
||||
|
||||
class ChangeStateFormREDESIGN(forms.Form):
|
||||
state = forms.ModelChoiceField(State.objects.filter(type="draft-iesg"), empty_label=None, required=True)
|
||||
state = forms.ModelChoiceField(State.objects.filter(used=True, type="draft-iesg"), empty_label=None, required=True)
|
||||
substate = forms.ModelChoiceField(DocTagName.objects.filter(slug__in=IESG_SUBSTATE_TAGS), required=False)
|
||||
comment = forms.CharField(widget=forms.Textarea, required=False)
|
||||
|
||||
|
@ -107,7 +107,7 @@ def change_stateREDESIGN(request, name):
|
|||
|
||||
if next_state.slug in ("iesg-eva", "lc"):
|
||||
if not doc.get_state_slug("draft-iana-review"):
|
||||
doc.set_state(State.objects.get(type="draft-iana-review", slug="need-rev"))
|
||||
doc.set_state(State.objects.get(used=True, type="draft-iana-review", slug="need-rev"))
|
||||
|
||||
if next_state.slug == "lc-req":
|
||||
request_last_call(request, doc)
|
||||
|
@ -136,7 +136,7 @@ def change_stateREDESIGN(request, name):
|
|||
to_iesg_eval = None
|
||||
if not doc.latest_event(type="sent_ballot_announcement"):
|
||||
if next_states and next_states.filter(slug="iesg-eva"):
|
||||
to_iesg_eval = State.objects.get(type="draft-iesg", slug="iesg-eva")
|
||||
to_iesg_eval = State.objects.get(used=True, type="draft-iesg", slug="iesg-eva")
|
||||
next_states = next_states.exclude(slug="iesg-eva")
|
||||
|
||||
return render_to_response('idrfc/change_stateREDESIGN.html',
|
||||
|
@ -158,7 +158,7 @@ class ChangeIanaStateForm(forms.Form):
|
|||
def __init__(self, state_type, *args, **kwargs):
|
||||
super(self.__class__, self).__init__(*args, **kwargs)
|
||||
|
||||
choices = State.objects.filter(type=state_type).order_by("order").values_list("pk", "name")
|
||||
choices = State.objects.filter(used=True, type=state_type).order_by("order").values_list("pk", "name")
|
||||
self.fields['state'].choices = [("", "-------")] + list(choices)
|
||||
|
||||
@role_required('Secretariat', 'IANA')
|
||||
|
@ -346,7 +346,7 @@ class EditInfoFormREDESIGN(forms.Form):
|
|||
intended_std_level = forms.ModelChoiceField(IntendedStdLevelName.objects.filter(used=True), empty_label="(None)", required=True, label="Intended RFC status")
|
||||
area = forms.ModelChoiceField(Group.objects.filter(type="area", state="active"), empty_label="(None - individual submission)", required=False, label="Assigned to area")
|
||||
ad = forms.ModelChoiceField(Person.objects.filter(role__name="ad", role__group__state="active").order_by('name'), label="Responsible AD", empty_label="(None)", required=True)
|
||||
create_in_state = forms.ModelChoiceField(State.objects.filter(type="draft-iesg", slug__in=("pub-req", "watching")), empty_label=None, required=False)
|
||||
create_in_state = forms.ModelChoiceField(State.objects.filter(used=True, type="draft-iesg", slug__in=("pub-req", "watching")), empty_label=None, required=False)
|
||||
notify = forms.CharField(max_length=255, label="Notice emails", help_text="Separate email addresses with commas", required=False)
|
||||
note = forms.CharField(widget=forms.Textarea, label="IESG note", required=False)
|
||||
telechat_date = forms.TypedChoiceField(coerce=lambda x: datetime.datetime.strptime(x, '%Y-%m-%d').date(), empty_value=None, required=False, widget=forms.Select(attrs={'onchange':'make_bold()'}))
|
||||
|
@ -635,7 +635,7 @@ def resurrectREDESIGN(request, name):
|
|||
e.desc = "Resurrection was completed"
|
||||
e.save()
|
||||
|
||||
doc.set_state(State.objects.get(type="draft", slug="active"))
|
||||
doc.set_state(State.objects.get(used=True, type="draft", slug="active"))
|
||||
doc.expires = datetime.datetime.now() + datetime.timedelta(settings.INTERNET_DRAFT_DAYS_TO_EXPIRE)
|
||||
doc.time = datetime.datetime.now()
|
||||
doc.save()
|
||||
|
@ -944,7 +944,7 @@ def request_publication(request, name):
|
|||
m.to = "RFC Editor <rfc-editor@rfc-editor.org>"
|
||||
m.by = request.user.get_profile()
|
||||
|
||||
next_state = State.objects.get(type="draft-stream-%s" % doc.stream.slug, slug="rfc-edit")
|
||||
next_state = State.objects.get(used=True, type="draft-stream-%s" % doc.stream.slug, slug="rfc-edit")
|
||||
|
||||
if request.method == 'POST' and not request.POST.get("reset"):
|
||||
form = PublicationForm(request.POST)
|
||||
|
|
|
@ -274,7 +274,7 @@ if settings.USE_DB_REDESIGN_PROXY_CLASSES:
|
|||
group = forms.CharField(required=False)
|
||||
area = forms.ModelChoiceField(Group.objects.filter(type="area", state="active").order_by('name'), empty_label="any area", required=False)
|
||||
ad = forms.ChoiceField(choices=(), required=False)
|
||||
state = forms.ModelChoiceField(State.objects.filter(type="draft-iesg"), empty_label="any state", required=False)
|
||||
state = forms.ModelChoiceField(State.objects.filter(used=True, type="draft-iesg"), empty_label="any state", required=False)
|
||||
subState = forms.ChoiceField(choices=(), required=False)
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
|
|
@ -537,7 +537,7 @@ class DeferUndeferTestCase(django.test.TestCase):
|
|||
e.save()
|
||||
defer_states = dict(draft=['draft-iesg','defer'],conflrev=['conflrev','defer'])
|
||||
if doc.type_id in defer_states:
|
||||
doc.set_state(State.objects.get(type=defer_states[doc.type_id][0],slug=defer_states[doc.type_id][1]))
|
||||
doc.set_state(State.objects.get(used=True, type=defer_states[doc.type_id][0],slug=defer_states[doc.type_id][1]))
|
||||
doc.save()
|
||||
|
||||
# get
|
||||
|
|
|
@ -130,7 +130,7 @@ class NoWorkflowStateForm(StreamDraftForm):
|
|||
|
||||
if settings.USE_DB_REDESIGN_PROXY_CLASSES:
|
||||
from ietf.doc.models import State
|
||||
to_state = State.objects.get(slug="c-adopt", type="draft-stream-%s" % self.draft.stream_id)
|
||||
to_state = State.objects.get(used=True, slug="c-adopt", type="draft-stream-%s" % self.draft.stream_id)
|
||||
else:
|
||||
to_state = get_state_by_name(CALL_FOR_ADOPTION)
|
||||
update_state(self.request, self.draft,
|
||||
|
@ -215,7 +215,7 @@ class DraftTagsStateForm(StreamDraftForm):
|
|||
next_states = transitions[0].next_states.all()
|
||||
else:
|
||||
# return the initial state
|
||||
states = State.objects.filter(type=state_type).order_by('order')
|
||||
states = State.objects.filter(used=True, type=state_type).order_by('order')
|
||||
if states:
|
||||
next_states = states[:1]
|
||||
|
||||
|
@ -233,7 +233,7 @@ class DraftTagsStateForm(StreamDraftForm):
|
|||
return []
|
||||
|
||||
from ietf.doc.models import State
|
||||
states = State.objects.filter(type="draft-stream-%s" % self.draft.stream_id)
|
||||
states = State.objects.filter(used=True, type="draft-stream-%s" % self.draft.stream_id)
|
||||
if self.draft.stream_id == "ietf" and self.draft.group:
|
||||
unused_states = self.draft.group.unused_states.values_list("pk", flat=True)
|
||||
states = [s for s in states if s.pk not in unused_states]
|
||||
|
|
|
@ -116,7 +116,7 @@ class EditStreamInfoTestCase(django.test.TestCase):
|
|||
self.assertEquals(len(q('select[name=new_state]')), 1)
|
||||
|
||||
# set state
|
||||
new_state = State.objects.get(type="draft-stream-%s" % draft.stream_id, slug="parked")
|
||||
new_state = State.objects.get(used=True, type="draft-stream-%s" % draft.stream_id, slug="parked")
|
||||
mailbox_before = len(outbox)
|
||||
events_before = draft.docevent_set.count()
|
||||
r = self.client.post(url,
|
||||
|
|
|
@ -141,7 +141,7 @@ def get_state_for_draft(draft):
|
|||
|
||||
def get_state_by_name(state_name):
|
||||
try:
|
||||
return State.objects.get(name=state_name)
|
||||
return State.objects.get(used=True, name=state_name)
|
||||
except State.DoesNotExist:
|
||||
return None
|
||||
|
||||
|
|
|
@ -162,7 +162,7 @@ class SubmitTestCase(django.test.TestCase):
|
|||
draft = make_test_data()
|
||||
|
||||
# pretend IANA reviewed it
|
||||
draft.set_state(State.objects.get(type="draft-iana-review", slug="not-ok"))
|
||||
draft.set_state(State.objects.get(used=True, type="draft-iana-review", slug="not-ok"))
|
||||
|
||||
# pretend it was approved to check that we notify the RFC Editor
|
||||
e = DocEvent(type="iesg_approved", doc=draft)
|
||||
|
|
|
@ -139,7 +139,7 @@ def perform_postREDESIGN(request, submission):
|
|||
else:
|
||||
submitter = system
|
||||
|
||||
draft.set_state(State.objects.get(type="draft", slug="active"))
|
||||
draft.set_state(State.objects.get(used=True, type="draft", slug="active"))
|
||||
DocAlias.objects.get_or_create(name=submission.filename, document=draft)
|
||||
|
||||
update_authors(draft, submission)
|
||||
|
@ -153,11 +153,11 @@ def perform_postREDESIGN(request, submission):
|
|||
|
||||
if draft.stream_id == "ietf" and draft.group.type_id == "wg" and draft.rev == "00":
|
||||
# automatically set state "WG Document"
|
||||
draft.set_state(State.objects.get(type="draft-stream-%s" % draft.stream_id, slug="wg-doc"))
|
||||
draft.set_state(State.objects.get(used=True, type="draft-stream-%s" % draft.stream_id, slug="wg-doc"))
|
||||
|
||||
if draft.get_state_slug("draft-iana-review") in ("ok-act", "ok-noact", "not-ok"):
|
||||
prev_state = draft.get_state("draft-iana-review")
|
||||
next_state = State.objects.get(type="draft-iana-review", slug="changed")
|
||||
next_state = State.objects.get(used=True, type="draft-iana-review", slug="changed")
|
||||
draft.set_state(next_state)
|
||||
add_state_change_event(draft, submitter, prev_state, next_state)
|
||||
|
||||
|
|
|
@ -5,25 +5,25 @@ def find_discrepancies():
|
|||
|
||||
title = "Drafts that have been sent to the RFC Editor but do not have an RFC Editor state"
|
||||
|
||||
docs = Document.objects.filter(states__in=list(State.objects.filter(type="draft-iesg", slug__in=("ann", "rfcqueue")))).exclude(states__in=list(State.objects.filter(type="draft-rfceditor")))
|
||||
docs = Document.objects.filter(states__in=list(State.objects.filter(used=True, type="draft-iesg", slug__in=("ann", "rfcqueue")))).exclude(states__in=list(State.objects.filter(used=True, type="draft-rfceditor")))
|
||||
|
||||
res.append((title, docs))
|
||||
|
||||
title = "Drafts that have the IANA Action state \"In Progress\" but do not have a \"IANA\" RFC-Editor state/tag"
|
||||
|
||||
docs = Document.objects.filter(states__in=list(State.objects.filter(type="draft-iana-action", slug__in=("inprog",)))).exclude(tags="iana").exclude(states__in=list(State.objects.filter(type="draft-rfceditor", slug="iana")))
|
||||
docs = Document.objects.filter(states__in=list(State.objects.filter(used=True, type="draft-iana-action", slug__in=("inprog",)))).exclude(tags="iana").exclude(states__in=list(State.objects.filter(used=True, type="draft-rfceditor", slug="iana")))
|
||||
|
||||
res.append((title, docs))
|
||||
|
||||
title = "Drafts that have the IANA Action state \"Waiting on RFC Editor\" or \"RFC-Ed-Ack\" but are in the RFC Editor state \"IANA\"/tagged with \"IANA\""
|
||||
|
||||
docs = Document.objects.filter(states__in=list(State.objects.filter(type="draft-iana-action", slug__in=("waitrfc", "rfcedack")))).filter(models.Q(tags="iana") | models.Q(states__in=list(State.objects.filter(type="draft-rfceditor", slug="iana"))))
|
||||
docs = Document.objects.filter(states__in=list(State.objects.filter(used=True, type="draft-iana-action", slug__in=("waitrfc", "rfcedack")))).filter(models.Q(tags="iana") | models.Q(states__in=list(State.objects.filter(used=True, type="draft-rfceditor", slug="iana"))))
|
||||
|
||||
res.append((title, docs))
|
||||
|
||||
title = "Drafts that have a state other than \"RFC Ed Queue\", \"RFC Published\" or \"Sent to the RFC Editor\" and have an RFC Editor or IANA Action state"
|
||||
|
||||
docs = Document.objects.exclude(states__in=list(State.objects.filter(type="draft-iesg", slug__in=("rfcqueue", "pub"))) + list(State.objects.filter(type__in=("draft-stream-iab", "draft-stream-ise", "draft-stream-irtf"), slug="rfc-edit"))).filter(states__in=list(State.objects.filter(type__in=("draft-iana-action", "draft-rfceditor"))))
|
||||
docs = Document.objects.exclude(states__in=list(State.objects.filter(used=True, type="draft-iesg", slug__in=("rfcqueue", "pub"))) + list(State.objects.filter(used=True, type__in=("draft-stream-iab", "draft-stream-ise", "draft-stream-irtf"), slug="rfc-edit"))).filter(states__in=list(State.objects.filter(used=True, type__in=("draft-iana-action", "draft-rfceditor"))))
|
||||
|
||||
res.append((title, docs))
|
||||
|
||||
|
|
|
@ -100,7 +100,7 @@ def update_history_with_changes(changes, send_email=True):
|
|||
states = {}
|
||||
|
||||
slookup = dict((s.slug, s)
|
||||
for s in State.objects.filter(type=StateType.objects.get(slug="draft-iana-action")))
|
||||
for s in State.objects.filter(used=True, type=StateType.objects.get(slug="draft-iana-action")))
|
||||
states["action"] = {
|
||||
"": slookup["newdoc"],
|
||||
"In Progress": slookup["inprog"],
|
||||
|
@ -124,7 +124,7 @@ def update_history_with_changes(changes, send_email=True):
|
|||
}
|
||||
|
||||
slookup = dict((s.slug, s)
|
||||
for s in State.objects.filter(type=StateType.objects.get(slug="draft-iana-review")))
|
||||
for s in State.objects.filter(used=True, type=StateType.objects.get(slug="draft-iana-review")))
|
||||
states["review"] = {
|
||||
"IANA Review Needed": slookup["need-rev"],
|
||||
"IANA OK - Actions Needed": slookup["ok-act"],
|
||||
|
|
|
@ -108,7 +108,7 @@ def update_drafts_from_queue(drafts):
|
|||
}
|
||||
|
||||
slookup = dict((s.slug, s)
|
||||
for s in State.objects.filter(type=StateType.objects.get(slug="draft-rfceditor")))
|
||||
for s in State.objects.filter(used=True, type=StateType.objects.get(slug="draft-rfceditor")))
|
||||
state_mapping = {
|
||||
'AUTH': slookup['auth'],
|
||||
'AUTH48': slookup['auth48'],
|
||||
|
@ -354,7 +354,7 @@ def update_docs_from_rfc_index(data, skip_older_than_date=None):
|
|||
changed_attributes["std_level"] = std_level_mapping[current_status]
|
||||
|
||||
if doc.get_state_slug() != "rfc":
|
||||
changed_states.append(State.objects.get(type="draft", slug="rfc"))
|
||||
changed_states.append(State.objects.get(used=True, type="draft", slug="rfc"))
|
||||
|
||||
if doc.stream != stream_mapping[stream]:
|
||||
changed_attributes["stream"] = stream_mapping[stream]
|
||||
|
@ -386,7 +386,7 @@ def update_docs_from_rfc_index(data, skip_older_than_date=None):
|
|||
for t in ("draft-iesg", "draft-stream-iab", "draft-stream-irtf", "draft-stream-ise"):
|
||||
slug = doc.get_state_slug(t)
|
||||
if slug and slug != "pub":
|
||||
changed_states.append(State.objects.get(type=t, slug="pub"))
|
||||
changed_states.append(State.objects.get(used=True, type=t, slug="pub"))
|
||||
|
||||
def parse_relation_list(l):
|
||||
res = []
|
||||
|
|
|
@ -175,10 +175,10 @@ class RFCSyncTestCase(django.test.TestCase):
|
|||
|
||||
def test_rfc_index(self):
|
||||
doc = make_test_data()
|
||||
doc.set_state(State.objects.get(type="draft-iesg", slug="rfcqueue"))
|
||||
doc.set_state(State.objects.get(used=True, type="draft-iesg", slug="rfcqueue"))
|
||||
# it's a bit strange to have this set when draft-iesg is set
|
||||
# too, but for testing purposes ...
|
||||
doc.set_state(State.objects.get(type="draft-stream-ise", slug="rfc-edit"))
|
||||
doc.set_state(State.objects.get(used=True, type="draft-stream-ise", slug="rfc-edit"))
|
||||
|
||||
updated_doc = Document.objects.create(name="draft-ietf-something")
|
||||
DocAlias.objects.create(name=updated_doc.name, document=updated_doc)
|
||||
|
@ -302,7 +302,7 @@ class RFCSyncTestCase(django.test.TestCase):
|
|||
def test_rfc_queue(self):
|
||||
draft = make_test_data()
|
||||
|
||||
draft.set_state(State.objects.get(type="draft-iesg", slug="ann"))
|
||||
draft.set_state(State.objects.get(used=True, type="draft-iesg", slug="ann"))
|
||||
|
||||
t = '''<rfc-editor-queue xmlns="http://www.rfc-editor.org/rfc-editor-queue">
|
||||
<section name="IETF STREAM: WORKING GROUP STANDARDS TRACK">
|
||||
|
@ -369,16 +369,16 @@ class DiscrepanciesTestCase(django.test.TestCase):
|
|||
|
||||
# draft approved but no RFC Editor state
|
||||
doc = Document.objects.create(name="draft-ietf-test1", type_id="draft")
|
||||
doc.set_state(State.objects.get(type="draft-iesg", slug="ann"))
|
||||
doc.set_state(State.objects.get(used=True, type="draft-iesg", slug="ann"))
|
||||
|
||||
r = self.client.get(urlreverse("ietf.sync.views.discrepancies"))
|
||||
self.assertTrue(doc.name in r.content)
|
||||
|
||||
# draft with IANA state "In Progress" but RFC Editor state not IANA
|
||||
doc = Document.objects.create(name="draft-ietf-test2", type_id="draft")
|
||||
doc.set_state(State.objects.get(type="draft-iesg", slug="rfcqueue"))
|
||||
doc.set_state(State.objects.get(type="draft-iana-action", slug="inprog"))
|
||||
doc.set_state(State.objects.get(type="draft-rfceditor", slug="auth"))
|
||||
doc.set_state(State.objects.get(used=True, type="draft-iesg", slug="rfcqueue"))
|
||||
doc.set_state(State.objects.get(used=True, type="draft-iana-action", slug="inprog"))
|
||||
doc.set_state(State.objects.get(used=True, type="draft-rfceditor", slug="auth"))
|
||||
|
||||
r = self.client.get(urlreverse("ietf.sync.views.discrepancies"))
|
||||
self.assertTrue(doc.name in r.content)
|
||||
|
@ -386,9 +386,9 @@ class DiscrepanciesTestCase(django.test.TestCase):
|
|||
# draft with IANA state "Waiting on RFC Editor" or "RFC-Ed-Ack"
|
||||
# but RFC Editor state is IANA
|
||||
doc = Document.objects.create(name="draft-ietf-test3", type_id="draft")
|
||||
doc.set_state(State.objects.get(type="draft-iesg", slug="rfcqueue"))
|
||||
doc.set_state(State.objects.get(type="draft-iana-action", slug="waitrfc"))
|
||||
doc.set_state(State.objects.get(type="draft-rfceditor", slug="iana"))
|
||||
doc.set_state(State.objects.get(used=True, type="draft-iesg", slug="rfcqueue"))
|
||||
doc.set_state(State.objects.get(used=True, type="draft-iana-action", slug="waitrfc"))
|
||||
doc.set_state(State.objects.get(used=True, type="draft-rfceditor", slug="iana"))
|
||||
|
||||
r = self.client.get(urlreverse("ietf.sync.views.discrepancies"))
|
||||
self.assertTrue(doc.name in r.content)
|
||||
|
@ -396,8 +396,8 @@ class DiscrepanciesTestCase(django.test.TestCase):
|
|||
# draft with state other than "RFC Ed Queue" or "RFC Published"
|
||||
# that are in RFC Editor or IANA queues
|
||||
doc = Document.objects.create(name="draft-ietf-test4", type_id="draft")
|
||||
doc.set_state(State.objects.get(type="draft-iesg", slug="ann"))
|
||||
doc.set_state(State.objects.get(type="draft-rfceditor", slug="auth"))
|
||||
doc.set_state(State.objects.get(used=True, type="draft-iesg", slug="ann"))
|
||||
doc.set_state(State.objects.get(used=True, type="draft-rfceditor", slug="auth"))
|
||||
|
||||
r = self.client.get(urlreverse("ietf.sync.views.discrepancies"))
|
||||
self.assertTrue(doc.name in r.content)
|
||||
|
@ -409,12 +409,12 @@ class RFCEditorUndoTestCase(django.test.TestCase):
|
|||
draft = make_test_data()
|
||||
|
||||
e1 = add_state_change_event(draft, Person.objects.get(name="(System)"), None,
|
||||
State.objects.get(type="draft-rfceditor", slug="auth"))
|
||||
State.objects.get(used=True, type="draft-rfceditor", slug="auth"))
|
||||
e1.desc = "First"
|
||||
e1.save()
|
||||
|
||||
e2 = add_state_change_event(draft, Person.objects.get(name="(System)"), None,
|
||||
State.objects.get(type="draft-rfceditor", slug="edit"))
|
||||
State.objects.get(used=True, type="draft-rfceditor", slug="edit"))
|
||||
e2.desc = "Second"
|
||||
e2.save()
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ def make_test_data():
|
|||
group=group,
|
||||
rev="00",
|
||||
)
|
||||
charter.set_state(State.objects.get(slug="approved", type="charter"))
|
||||
charter.set_state(State.objects.get(used=True, slug="approved", type="charter"))
|
||||
group.charter = charter
|
||||
group.save()
|
||||
DocAlias.objects.create(
|
||||
|
@ -88,7 +88,7 @@ def make_test_data():
|
|||
group=group,
|
||||
rev="00",
|
||||
)
|
||||
charter.set_state(State.objects.get(slug="infrev", type="charter"))
|
||||
charter.set_state(State.objects.get(used=True, slug="infrev", type="charter"))
|
||||
DocAlias.objects.create(
|
||||
name=charter.name,
|
||||
document=charter
|
||||
|
@ -319,9 +319,9 @@ def make_test_data():
|
|||
note="",
|
||||
)
|
||||
|
||||
draft.set_state(State.objects.get(type="draft", slug="active"))
|
||||
draft.set_state(State.objects.get(type="draft-iesg", slug="pub-req"))
|
||||
draft.set_state(State.objects.get(type="draft-stream-%s" % draft.stream_id, slug="wg-doc"))
|
||||
draft.set_state(State.objects.get(used=True, type="draft", slug="active"))
|
||||
draft.set_state(State.objects.get(used=True, type="draft-iesg", slug="pub-req"))
|
||||
draft.set_state(State.objects.get(used=True, type="draft-stream-%s" % draft.stream_id, slug="wg-doc"))
|
||||
|
||||
doc_alias = DocAlias.objects.create(
|
||||
document=draft,
|
||||
|
@ -396,7 +396,7 @@ def make_test_data():
|
|||
doc.save()
|
||||
crdoc = Document.objects.create(name='conflict-review-imaginary-irtf-submission',type_id='conflrev',rev='00',notify="fsm@ietf.org")
|
||||
DocAlias.objects.create( name='conflict-review-imaginary-irtf-submission',document=crdoc)
|
||||
crdoc.set_state(State.objects.get(name='Needs Shepherd',type__slug='conflrev'))
|
||||
crdoc.set_state(State.objects.get(used=True, name='Needs Shepherd',type__slug='conflrev'))
|
||||
crdoc.save()
|
||||
crdoc.relateddocument_set.create(target=docalias,relationship_id='conflrev')
|
||||
|
||||
|
|
|
@ -127,7 +127,7 @@ class ManageShepherdsTestCase(django.test.TestCase):
|
|||
shepherd=Person.objects.get(user__username="plain"),
|
||||
**common)
|
||||
for d in Document.objects.filter(name__startswith="test-shepherd"):
|
||||
d.set_state(State.objects.get(type="draft", slug="active"))
|
||||
d.set_state(State.objects.get(used=True, type="draft", slug="active"))
|
||||
|
||||
# get and make sure they are divided correctly
|
||||
r = self.client.get(url)
|
||||
|
@ -197,7 +197,7 @@ class ManageWorkflowTestCase(django.test.TestCase):
|
|||
url = urlreverse('manage_workflow', kwargs=dict(acronym=group.acronym))
|
||||
login_testing_unauthorized(self, "secretary", url)
|
||||
|
||||
state = State.objects.get(type="draft-stream-ietf", slug="wg-lc")
|
||||
state = State.objects.get(used=True, type="draft-stream-ietf", slug="wg-lc")
|
||||
self.assertTrue(state not in group.unused_states.all())
|
||||
|
||||
# get
|
||||
|
@ -218,8 +218,8 @@ class ManageWorkflowTestCase(django.test.TestCase):
|
|||
self.assertTrue(state in group.unused_states.all())
|
||||
|
||||
# change next states
|
||||
state = State.objects.get(type="draft-stream-ietf", slug="wg-doc")
|
||||
next_states = State.objects.filter(type=b"draft-stream-ietf", slug__in=["parked", "dead", "wait-wgw", 'sub-pub']).values_list('pk', flat=True)
|
||||
state = State.objects.get(used=True, type="draft-stream-ietf", slug="wg-doc")
|
||||
next_states = State.objects.filter(used=True, type=b"draft-stream-ietf", slug__in=["parked", "dead", "wait-wgw", 'sub-pub']).values_list('pk', flat=True)
|
||||
r = self.client.post(url,
|
||||
dict(action="setnextstates",
|
||||
state=state.pk,
|
||||
|
|
|
@ -124,7 +124,7 @@ def manage_workflowREDESIGN(request, acronym):
|
|||
except State.DoesNotExist:
|
||||
return HttpResponse("Invalid state %s" % request.POST.get("state"))
|
||||
|
||||
next_states = State.objects.filter(type='draft-stream-ietf', pk__in=request.POST.getlist("next_states"))
|
||||
next_states = State.objects.filter(used=True, type='draft-stream-ietf', pk__in=request.POST.getlist("next_states"))
|
||||
unused = wg.unused_states.all()
|
||||
if set(next_states.exclude(pk__in=unused)) == set(state.next_states.exclude(pk__in=unused)):
|
||||
# just use the default
|
||||
|
@ -153,7 +153,7 @@ def manage_workflowREDESIGN(request, acronym):
|
|||
t.used = t.slug not in unused_tags
|
||||
|
||||
unused_states = wg.unused_states.all().values_list('slug', flat=True)
|
||||
states = State.objects.filter(type="draft-stream-ietf")
|
||||
states = State.objects.filter(used=True, type="draft-stream-ietf")
|
||||
transitions = dict((o.state, o) for o in wg.groupstatetransitions_set.all())
|
||||
for s in states:
|
||||
s.used = s.slug not in unused_states
|
||||
|
|
|
@ -58,7 +58,7 @@ class EditCharterTestCase(django.test.TestCase):
|
|||
|
||||
# change state
|
||||
for slug in ("intrev", "extrev", "iesgrev"):
|
||||
s = State.objects.get(type="charter", slug=slug)
|
||||
s = State.objects.get(used=True, type="charter", slug=slug)
|
||||
events_before = charter.docevent_set.count()
|
||||
mailbox_before = len(outbox)
|
||||
|
||||
|
@ -230,7 +230,7 @@ class CharterApproveBallotTestCase(django.test.TestCase):
|
|||
desc="Created ballot",
|
||||
)
|
||||
|
||||
charter.set_state(State.objects.get(type="charter", slug="iesgrev"))
|
||||
charter.set_state(State.objects.get(used=True, type="charter", slug="iesgrev"))
|
||||
|
||||
# normal get
|
||||
r = self.client.get(url)
|
||||
|
|
|
@ -30,7 +30,7 @@ from ietf.wgcharter.utils import *
|
|||
import debug
|
||||
|
||||
class ChangeStateForm(forms.Form):
|
||||
charter_state = forms.ModelChoiceField(State.objects.filter(type="charter", slug__in=["infrev", "intrev", "extrev", "iesgrev"]), label="Charter state", empty_label=None, required=False)
|
||||
charter_state = forms.ModelChoiceField(State.objects.filter(used=True, type="charter", slug__in=["infrev", "intrev", "extrev", "iesgrev"]), label="Charter state", empty_label=None, required=False)
|
||||
initial_time = forms.IntegerField(initial=0, label="Review time", help_text="(in weeks)", required=False)
|
||||
message = forms.CharField(widget=forms.Textarea, help_text="Leave blank to change state without notifying the Secretariat", required=False, label=mark_safe("Message to<br> Secretariat"))
|
||||
comment = forms.CharField(widget=forms.Textarea, help_text="Optional comment for the charter history", required=False)
|
||||
|
@ -64,7 +64,7 @@ def change_state(request, name, option=None):
|
|||
charter_rev = charter.rev
|
||||
|
||||
if option in ("initcharter", "recharter"):
|
||||
charter_state = State.objects.get(type="charter", slug="infrev")
|
||||
charter_state = State.objects.get(used=True, type="charter", slug="infrev")
|
||||
# make sure we have the latest revision set, if we
|
||||
# abandoned a charter before, we could have reset the
|
||||
# revision to latest approved
|
||||
|
@ -77,7 +77,7 @@ def change_state(request, name, option=None):
|
|||
elif option == "abandon":
|
||||
oldstate = wg.state_id
|
||||
if oldstate in ("proposed","bof","unknown"):
|
||||
charter_state = State.objects.get(type="charter", slug="notrev")
|
||||
charter_state = State.objects.get(used=True, type="charter", slug="notrev")
|
||||
#TODO : set an abandoned state and leave some comments here
|
||||
wg.state=GroupStateName.objects.get(slug='abandon')
|
||||
wg.save()
|
||||
|
@ -89,7 +89,7 @@ def change_state(request, name, option=None):
|
|||
e.save()
|
||||
|
||||
else:
|
||||
charter_state = State.objects.get(type="charter", slug="approved")
|
||||
charter_state = State.objects.get(used=True, type="charter", slug="approved")
|
||||
charter_rev = approved_revision(charter.rev)
|
||||
else:
|
||||
charter_state = clean['charter_state']
|
||||
|
@ -176,7 +176,7 @@ def change_state(request, name, option=None):
|
|||
title = "Change chartering state of WG %s" % wg.acronym
|
||||
|
||||
def state_pk(slug):
|
||||
return State.objects.get(type="charter", slug=slug).pk
|
||||
return State.objects.get(used=True, type="charter", slug=slug).pk
|
||||
|
||||
info_msg = {
|
||||
state_pk("infrev"): 'The WG "%s" (%s) has been set to Informal IESG review by %s.' % (wg.name, wg.acronym, login.plain_name()),
|
||||
|
@ -184,7 +184,7 @@ def change_state(request, name, option=None):
|
|||
state_pk("extrev"): 'The WG "%s" (%s) has been set to External review by %s.\nPlease send out the external review announcement to the appropriate lists.\n\nSend the announcement to other SDOs: Yes\nAdditional recipients of the announcement: ' % (wg.name, wg.acronym, login.plain_name()),
|
||||
}
|
||||
|
||||
states_for_ballot_wo_extern = State.objects.filter(type="charter", slug="intrev").values_list("pk", flat=True)
|
||||
states_for_ballot_wo_extern = State.objects.filter(used=True, type="charter", slug="intrev").values_list("pk", flat=True)
|
||||
|
||||
return render_to_response('wgcharter/change_state.html',
|
||||
dict(form=form,
|
||||
|
@ -584,7 +584,7 @@ def approve(request, name):
|
|||
announcement = e.text
|
||||
|
||||
if request.method == 'POST':
|
||||
new_charter_state = State.objects.get(type="charter", slug="approved")
|
||||
new_charter_state = State.objects.get(used=True, type="charter", slug="approved")
|
||||
prev_charter_state = charter.get_state()
|
||||
|
||||
save_document_in_history(charter)
|
||||
|
|
|
@ -118,7 +118,7 @@ def get_or_create_initial_charter(wg):
|
|||
rev="00-00",
|
||||
)
|
||||
charter.save()
|
||||
charter.set_state(State.objects.get(type="charter", slug="notrev"))
|
||||
charter.set_state(State.objects.get(used=True, type="charter", slug="notrev"))
|
||||
|
||||
# Create an alias as well
|
||||
DocAlias.objects.create(
|
||||
|
|
|
@ -71,7 +71,7 @@ class WgOverviewTestCase(django.test.TestCase):
|
|||
make_test_data()
|
||||
|
||||
wg = Group.objects.get(acronym="mars")
|
||||
wg.charter.set_state(State.objects.get(type="charter", slug="intrev"))
|
||||
wg.charter.set_state(State.objects.get(used=True, type="charter", slug="intrev"))
|
||||
|
||||
url = urlreverse('ietf.wginfo.views.chartering_wgs')
|
||||
r = self.client.get(url)
|
||||
|
|
|
@ -127,7 +127,7 @@ def bofs(request):
|
|||
return render_to_response('wginfo/bofs.html',dict(groups=groups),RequestContext(request))
|
||||
|
||||
def chartering_wgs(request):
|
||||
charter_states = State.objects.filter(type="charter").exclude(slug__in=("approved", "notrev"))
|
||||
charter_states = State.objects.filter(used=True, type="charter").exclude(slug__in=("approved", "notrev"))
|
||||
groups = Group.objects.filter(type="wg", charter__states__in=charter_states).select_related("state", "charter")
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue