Skip to content

Commit 2a2389d

Browse files
committed
Merged in branch/iola/shimfree@6083. This cleans up and moves relevant code from idrfc/ to doc/. There should now only be a bit of old wrapper code left in idrfc; that will go away when the remaining models which use it are cleaned up.
- Legacy-Id: 6117
2 parents c93e5cc + 9b65f3b commit 2a2389d

143 files changed

Lines changed: 995 additions & 4896 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

ietf/bin/expire-ids

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ management.setup_environ(settings)
99

1010
syslog.openlog(os.path.basename(__file__), syslog.LOG_PID, syslog.LOG_USER)
1111

12-
from ietf.idrfc.expire import *
12+
from ietf.doc.expire import *
1313

1414
if not in_draft_expire_freeze():
1515
for doc in get_expired_drafts():

ietf/bin/expire-last-calls

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ management.setup_environ(settings)
99

1010
syslog.openlog(os.path.basename(__file__), syslog.LOG_PID, syslog.LOG_USER)
1111

12-
from ietf.idrfc.lastcall import *
12+
from ietf.doc.lastcall import *
1313

1414
drafts = get_expired_last_calls()
1515
for doc in drafts:

ietf/bin/notify-expirations

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ from ietf import settings
66
from django.core import management
77
management.setup_environ(settings)
88

9-
from ietf.idrfc.expire import get_soon_to_expire_drafts, send_expire_warning_for_draft
9+
from ietf.doc.expire import get_soon_to_expire_drafts, send_expire_warning_for_draft
1010

1111

1212
# notify about documents that expire within the next 2 weeks

ietf/bin/test-crawl

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ while urls:
6464
print "was fetching", url
6565
sys.exit(1)
6666
except:
67-
print "FAIL", url
67+
print 500, "%.3fs" % (datetime.datetime.now() - timestamp).total_seconds(), url, "FAIL (from %s)" % referrer
6868
print "============="
6969
print traceback.format_exc()
7070
print "============="
@@ -82,9 +82,15 @@ while urls:
8282
ctype = ctype[:ctype.index(";")]
8383

8484
if ctype == "text/html":
85-
for u in extract_html_urls(r.content):
86-
if u not in visited and u not in urls:
87-
urls[u] = url
85+
try:
86+
for u in extract_html_urls(r.content):
87+
if u not in visited and u not in urls:
88+
urls[u] = url
89+
except:
90+
print "error extracting HTML urls from", url
91+
print "============="
92+
print traceback.format_exc()
93+
print "============="
8894
else:
8995
tags.append(u"FAIL (from %s)" % referrer)
9096

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
from django.template.loader import render_to_string
55
from django.db.models import Q
66

7-
import datetime, os, shutil, glob, re, itertools
7+
import datetime, os, shutil, glob, re
88

99
from ietf.utils.mail import send_mail, send_mail_subj
10-
from ietf.idrfc.utils import log_state_changed
1110
from ietf.doc.models import Document, DocEvent, State, save_document_in_history, IESG_SUBSTATE_TAGS
1211
from ietf.person.models import Person, Email
1312
from ietf.meeting.models import Meeting
13+
from ietf.doc.utils import log_state_changed
1414

1515
def expirable_draft(draft):
1616
"""Return whether draft is in an expirable state or not. This is
@@ -82,7 +82,7 @@ def send_expire_warning_for_draft(doc):
8282
if to or cc:
8383
send_mail(request, to, frm,
8484
u"Expiration impending: %s" % doc.file_tag(),
85-
"idrfc/expire_warning_email.txt",
85+
"doc/draft/expire_warning_email.txt",
8686
dict(doc=doc,
8787
state=state,
8888
expiration=expiration
@@ -101,7 +101,7 @@ def send_expire_notice_for_draft(doc):
101101
send_mail(request, to,
102102
"I-D Expiring System <ietf-secretariat-reply@ietf.org>",
103103
u"I-D was expired %s" % doc.file_tag(),
104-
"idrfc/id_expired_email.txt",
104+
"doc/draft/id_expired_email.txt",
105105
dict(doc=doc,
106106
state=state,
107107
))
@@ -128,14 +128,14 @@ def expire_draft(doc):
128128
save_document_in_history(doc)
129129
if doc.latest_event(type='started_iesg_process'):
130130
dead_state = State.objects.get(used=True, type="draft-iesg", slug="dead")
131-
prev = doc.get_state("draft-iesg")
131+
prev_state = doc.friendly_state()
132132
prev_tag = doc.tags.filter(slug__in=IESG_SUBSTATE_TAGS)
133133
prev_tag = prev_tag[0] if prev_tag else None
134-
if prev != dead_state:
134+
if doc.get_state("draft-iesg") != dead_state:
135135
doc.set_state(dead_state)
136136
if prev_tag:
137137
doc.tags.remove(prev_tag)
138-
log_state_changed(None, doc, system, prev, prev_tag)
138+
log_state_changed(None, doc, system, doc.friendly_state(), prev_state)
139139

140140
e = DocEvent(doc=doc, by=system)
141141
e.type = "expired_document"

ietf/doc/feeds.py

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

1313
from ietf.doc.models import *
1414
from ietf.doc.utils import augment_events_with_revision
15-
from ietf.idtracker.templatetags.ietf_filters import format_textarea
15+
from ietf.doc.templatetags.ietf_filters import format_textarea
1616

1717
class DocumentChanges(Feed):
1818
feed_type = Atom1Feed
Lines changed: 6 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,13 @@
33
import datetime
44

55
from django.conf import settings
6-
from django.db.models import Q
76

8-
from ietf.idtracker.models import InternetDraft, DocumentComment, BallotInfo
9-
from ietf.idrfc.mails import *
10-
from ietf.idrfc.utils import *
117
from ietf.doc.models import *
128
from ietf.person.models import Person
13-
14-
import debug
9+
from ietf.doc.utils import log_state_changed
10+
from ietf.doc.mails import *
1511

1612
def request_last_call(request, doc):
17-
try:
18-
ballot = doc.idinternal.ballot
19-
except BallotInfo.DoesNotExist:
20-
ballot = generate_ballot(request, doc)
21-
22-
send_last_call_request(request, doc, ballot)
23-
add_document_comment(request, doc, "Last Call was requested")
24-
25-
def request_last_callREDESIGN(request, doc):
2613
if not doc.latest_event(type="changed_ballot_writeup_text"):
2714
generate_ballot_writeup(request, doc)
2815
if not doc.latest_event(type="changed_ballot_approval_text"):
@@ -39,14 +26,7 @@ def request_last_callREDESIGN(request, doc):
3926
e.desc = "Last call was requested"
4027
e.save()
4128

42-
if settings.USE_DB_REDESIGN_PROXY_CLASSES:
43-
request_last_call = request_last_callREDESIGN
44-
4529
def get_expired_last_calls():
46-
return InternetDraft.objects.filter(lc_expiration_date__lte=datetime.date.today(),
47-
idinternal__cur_state__document_state_id=IDState.IN_LAST_CALL)
48-
49-
def get_expired_last_callsREDESIGN():
5030
today = datetime.date.today()
5131
for d in Document.objects.filter(Q(states__type="draft-iesg", states__slug="lc")
5232
| Q(states__type="statchg", states__slug="in-lc")):
@@ -55,24 +35,6 @@ def get_expired_last_callsREDESIGN():
5535
yield d
5636

5737
def expire_last_call(doc):
58-
state = IDState.WAITING_FOR_WRITEUP
59-
60-
try:
61-
ballot = doc.idinternal.ballot
62-
if ballot.ballot_writeup and "Relevant content can frequently be found in the abstract" not in ballot.ballot_writeup:
63-
state = IDState.WAITING_FOR_AD_GO_AHEAD
64-
except BallotInfo.DoesNotExist:
65-
pass
66-
67-
doc.idinternal.change_state(IDState.objects.get(document_state_id=state), None)
68-
doc.idinternal.event_date = datetime.date.today()
69-
doc.idinternal.save()
70-
71-
log_state_changed(None, doc, by="system", email_watch_list=False)
72-
73-
email_last_call_expired(doc)
74-
75-
def expire_last_callREDESIGN(doc):
7638
if doc.type_id == 'draft':
7739
state = State.objects.get(used=True, type="draft-iesg", slug="writeupw")
7840
e = doc.latest_event(WriteupDocEvent, type="changed_ballot_writeup_text")
@@ -87,23 +49,19 @@ def expire_last_callREDESIGN(doc):
8749
else:
8850
raise ValueError("Unexpected document type to expire_last_call(): %s" % doc.type)
8951

90-
save_document_in_history(doc)
52+
prev_state = doc.friendly_state()
9153

54+
save_document_in_history(doc)
9255
doc.set_state(state)
9356

9457
prev_tag = doc.tags.filter(slug__in=IESG_SUBSTATE_TAGS)
9558
prev_tag = prev_tag[0] if prev_tag else None
9659
if prev_tag:
9760
doc.tags.remove(prev_tag)
9861

99-
e = log_state_changed(None, doc, Person.objects.get(name="(System)"), prev, prev_tag)
100-
62+
e = log_state_changed(None, doc, Person.objects.get(name="(System)"), doc.friendly_state(), prev_state)
63+
10164
doc.time = e.time
10265
doc.save()
10366

10467
email_last_call_expired(doc)
105-
106-
if settings.USE_DB_REDESIGN_PROXY_CLASSES:
107-
get_expired_last_calls = get_expired_last_callsREDESIGN
108-
expire_last_call = expire_last_callREDESIGN
109-

0 commit comments

Comments
 (0)