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
·41 lines (29 loc) · 1.25 KB
/
dump-draft-info
File metadata and controls
executable file
·41 lines (29 loc) · 1.25 KB
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
36
37
38
39
40
41
#!/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])
# boilerplate
basedir = os.path.abspath(os.path.join(os.path.dirname(__file__), "../.."))
sys.path = [ basedir ] + sys.path
os.environ["DJANGO_SETTINGS_MODULE"] = "ietf.settings"
virtualenv_activation = os.path.join(basedir, "env", "bin", "activate_this.py")
if os.path.exists(virtualenv_activation):
execfile(virtualenv_activation, dict(__file__=virtualenv_activation))
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')