Skip to content

Commit 31b5c1f

Browse files
committed
Merged in [10731] from rjsparks@nostrum.com:
Addresses issues uncovered by the test-crawler. Adds missing DocAlias records for several document types. Creates DocAlias objects when createing Document objects for those document types. Identifies places in code to touch when we are ready to expose the bluesheets and recording document types at /doc/. (The data rows and the content store need work before doing so). - Legacy-Id: 10746 Note: SVN reference [10731] has been migrated to Git commit 7573973
2 parents 4c710c5 + 7573973 commit 31b5c1f

8 files changed

Lines changed: 45 additions & 8 deletions

File tree

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# -*- coding: utf-8 -*-
2+
from __future__ import unicode_literals
3+
4+
from django.db import migrations
5+
from django.db.models import F
6+
7+
def reverse(apps, schema_editor):
8+
pass
9+
10+
def forward(apps, schema_editor):
11+
Document = apps.get_model('doc','Document')
12+
for doc in Document.objects.filter(type__in=['recording','liaison','liai-att']).exclude(docalias__name=F('name')):
13+
doc.docalias_set.create(name=doc.name)
14+
15+
class Migration(migrations.Migration):
16+
17+
dependencies = [
18+
('doc', '0010_auto_20150930_0251'),
19+
]
20+
21+
operations = [
22+
migrations.RunPython(forward,reverse)
23+
]

ietf/doc/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ def active_ballot(self):
234234

235235
def meeting_related(self):
236236
answer = False
237-
if self.type_id in ("agenda","minutes","bluesheets","slides"):
237+
if self.type_id in ("agenda","minutes","bluesheets","slides","recording"):
238238
answer = (self.name.split("-")[1] == "interim"
239239
or (self if isinstance(self, Document) else self.doc).session_set.exists())
240240
if self.type_id in ("slides",):

ietf/doc/tests.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -558,6 +558,9 @@ def test_document_primary_and_history_views(self):
558558
"agenda-42-mars",
559559
"minutes-42-mars",
560560
"slides-42-mars-1",
561+
# TODO: add
562+
#"bluesheets-42-mars-1",
563+
#"recording-42-mars-1-00",
561564
]:
562565
doc = Document.objects.get(name=docname)
563566
# give it some history

ietf/doc/views_doc.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -522,6 +522,8 @@ def document_main(request, name, rev=None):
522522
),
523523
context_instance=RequestContext(request))
524524

525+
# TODO : Add "recording", and "bluesheets" here when those documents are appropriately
526+
# created and content is made available on disk
525527
if doc.type_id in ("slides", "agenda", "minutes"):
526528
can_manage_material = can_manage_materials(request.user, doc.group)
527529
presentations = None

ietf/liaisons/forms.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,14 +346,16 @@ def save_attachments(self):
346346
extension = ''
347347
written += 1
348348
name = self.instance.name() + ("-attachment-%s" % written)
349-
attach, _ = Document.objects.get_or_create(
349+
attach, created = Document.objects.get_or_create(
350350
name = name,
351351
defaults=dict(
352352
title = attachment_title,
353353
type_id = "liai-att",
354354
external_url = name + extension, # strictly speaking not necessary, but just for the time being ...
355355
)
356356
)
357+
if created:
358+
attach.docalias_set.create(name=attach.name)
357359
LiaisonStatementAttachment.objects.create(statement=self.instance,document=attach)
358360
attach_file = open(os.path.join(settings.LIAISON_ATTACH_PATH, attach.name + extension), 'w')
359361
attach_file.write(attached_file.read())

ietf/secr/proceedings/proc_utils.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ def create_recording(session,meeting,group,url):
7777
rev='00',
7878
type_id='recording')
7979
doc.set_state(State.objects.get(type='recording', slug='active'))
80+
81+
doc.docalias_set.create(name=name)
8082

8183
# create DocEvent
8284
NewRevisionDocEvent.objects.create(type='new_revision',

ietf/templates/meeting/session_details.html

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,14 @@ <h2>{{ session.time }}{% if session.name %} : {{ session.name }}{% endif %}</h2>
1616

1717
<table class="table table-condensed table-striped">
1818
{% for pres in session.filtered_sessionpresentation_set %}
19-
<tr>
20-
<td>
21-
<a href="{% url 'doc_view' name=pres.document.name rev=pres.rev%}">{{pres.document.title}} ({{ pres.document.name }}-{{ pres.rev }})
22-
</a>
23-
</td>
24-
</tr>
19+
{% if pres.document.type_id != 'bluesheets' and pres.document.type_id != 'recording' %}
20+
<tr>
21+
<td>
22+
<a href="{% url 'doc_view' name=pres.document.name rev=pres.rev%}">{{pres.document.title}} ({{ pres.document.name }}-{{ pres.rev }})
23+
</a>
24+
</td>
25+
</tr>
26+
{% endif %}
2527
{% endfor %}
2628
</table>
2729
{% endif %}

ietf/utils/test_data.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,5 +351,8 @@ def other_doc_factory(type_id,name):
351351
other_doc_factory('agenda','agenda-42-mars')
352352
other_doc_factory('minutes','minutes-42-mars')
353353
other_doc_factory('slides','slides-42-mars-1')
354+
# TODO: add
355+
#other_doc_factory('bluesheets','bluesheets-42-mars-1')
356+
#other_doc_factory('recording','recording-42-mars-1-00')
354357

355358
return draft

0 commit comments

Comments
 (0)