forked from adamlaska/datatracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdump-draft-info
More file actions
executable file
·35 lines (24 loc) · 1002 Bytes
/
dump-draft-info
File metadata and controls
executable file
·35 lines (24 loc) · 1002 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/env python
import os
import sys
version = "0.10"
program = os.path.basename(sys.argv[0])
progdir = os.path.dirname(sys.argv[0])
sys.path = [progdir+"/../../"] + sys.path
os.environ["DJANGO_SETTINGS_MODULE"] = "ietf.settings"
import django
django.setup()
from django.template import Template, Context
from ietf.doc.models import Document
from ietf.person.models import Person
drafts = Document.objects.filter(type="draft")
ads = {}
for p in Person.objects.filter(ad_document_set__type="draft").distinct():
ads[p.id] = p.role_email("ad")
for d in drafts:
d.ad_email = ads.get(d.ad_id)
templ_text = """{% for draft in drafts %}{% if draft.notify or draft.ad_email %}{{ draft.name }}{% if draft.notify %} docnotify='{{ draft.notify|cut:"<"|cut:">" }}'{% endif %}{% if draft.ad_email %} docsponsor='{{ draft.ad_email }}'{% endif %}
{% endif %}{% endfor %}"""
template = Template(templ_text)
context = Context({ 'drafts':drafts })
print template.render(context).encode('utf-8')