Skip to content

Commit 02cd366

Browse files
committed
Merged in trunk@9440, containing the changes for version 5.13.1; and updated tests which look at HTML content to work with the facelift changes.
- Legacy-Id: 9446
2 parents 663fc30 + 39ed53e commit 02cd366

18 files changed

Lines changed: 3065 additions & 2750 deletions

changelog

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,45 @@
1+
ietfdb (5.13.1) ietf; urgency=medium
2+
3+
This is a bugfix release, to have a clean slate before merging in the
4+
Bootstrap facelift for 6.0.0. Details:
5+
6+
* Merged in [9428] from rjsparks@nostrum.com:
7+
Properly mark (and test) older ballot comment and discuss text after a new
8+
revision is submitted. Fixes bug #1656.
9+
10+
* Merged in [9426] from rcross@amsl.com:
11+
Add several 'From' options for IAD user of announcement tool.
12+
13+
* Merged in [9375] from rjsparks@nostrum.com:
14+
Put old style slides directly into archived. Migrate IETF92 materials to
15+
match.
16+
17+
* Merged in [9351] from rjsparks@nostrum.com:
18+
Removed sessonly, replacing the idea with a separate State. Add tests
19+
checking how materials show on agenda views.
20+
21+
* Fixed style attributes which resulted in red text on red background for
22+
some error messages
23+
24+
* Buildbot changes: Separated out the schedulers for trunk, personal/* and
25+
branch/*. Corrected regex patterns which extract unittest details. Added
26+
a first tentative email notifier. Added ForceSchedulers, in order to be
27+
able to force builds.
28+
29+
* Changed all explicitly set HttpResponse content_types to specify charset.
30+
Django sets charset if you don't specify a content_type; if you specify
31+
one you also must add a charset specification (if you want one). Fixes
32+
issue #1647.
33+
34+
* Fixed a typo in the sort key generation for the sort on ipr count in
35+
document search results.
36+
37+
* Updated release data and mkrelease support, which calculates the
38+
release coverage snapshot without invoking tests that developers won't
39+
ordinarily be able to run on their laptops/work machines.
40+
41+
-- Henrik Levkowetz <henrik@levkowetz.com> 10 Apr 2015 13:44:05 +0000
42+
143
ietfdb (5.13.0) ietf; urgency=medium
244

345
**IETF 92 Code Sprint**

ietf/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# Copyright The IETF Trust 2007, All Rights Reserved
22

3-
__version__ = "5.13.1.dev1"
3+
__version__ = "5.13.2.dev0"
44

55
__date__ = "$Date$"
66

7-
__rev__ = "$Rev$ (dev) Latest release: Rev. 9335 "
7+
__rev__ = "$Rev$ (dev) Latest release: Rev. 9438 "
88

99
__id__ = "$Id$"
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# -*- coding: utf-8 -*-
2+
from __future__ import unicode_literals
3+
4+
from django.db import migrations
5+
6+
def forward_materials_state(apps, schema_editor):
7+
StateType = apps.get_model('doc', 'StateType')
8+
State = apps.get_model('doc', 'State')
9+
10+
StateType.objects.create(slug='reuse_policy',label='Policy')
11+
12+
single = State.objects.create(type_id='reuse_policy',slug='single',name='Single Meeting')
13+
multiple = State.objects.create(type_id='reuse_policy',slug='multiple',name='Multiple Meetings')
14+
15+
Document = apps.get_model('doc', 'Document')
16+
for doc in Document.objects.filter(type='slides'):
17+
if doc.group.type.slug=='team':
18+
doc.states.add(multiple)
19+
else:
20+
doc.states.add(single)
21+
22+
# Expected to be a no-op on current database, but just for completeness
23+
for doc in Document.objects.filter(type='slides'):
24+
doc.states.filter(type='slides',slug='sessonly').update(slug='active')
25+
26+
State.objects.filter(type_id='slides',slug='sessonly').delete()
27+
28+
29+
def reverse_materials_state(apps, schema_editor):
30+
Document = apps.get_model('doc', 'Document')
31+
for doc in Document.objects.filter(type='slides'):
32+
doc.states.filter(type='update_policy').delete()
33+
34+
StateType = apps.get_model('doc', 'StateType')
35+
StateType.objects.filter(slug='update_policy').delete()
36+
37+
State = apps.get_model('doc', 'State')
38+
State.objects.create(type='slides',slug='sessonly',name='Session Only')
39+
40+
41+
class Migration(migrations.Migration):
42+
43+
dependencies = [
44+
('doc', '0002_auto_20141222_1749'),
45+
('group', '0003_auto_20150304_0743'),
46+
]
47+
48+
operations = [
49+
migrations.RunPython(forward_materials_state,reverse_materials_state),
50+
]
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# -*- coding: utf-8 -*-
2+
from __future__ import unicode_literals
3+
4+
from django.db import migrations
5+
6+
def set_state(doc, state):
7+
already_set = doc.states.filter(type=state.type)
8+
others = [s for s in already_set if s != state]
9+
if others:
10+
doc.states.remove(*others)
11+
if state not in already_set:
12+
doc.states.add(state)
13+
doc.state_cache = None
14+
15+
def forward_archive_slides(apps,schema_editor):
16+
Document = apps.get_model('doc', 'Document')
17+
State = apps.get_model('doc','State')
18+
archived = State.objects.get(type__slug='slides',slug='archived')
19+
for doc in Document.objects.filter(name__startswith='slides-92-',states__type__slug='slides',states__slug='active'):
20+
set_state(doc,archived)
21+
22+
def reverse_archive_slides(apps,schema_editor):
23+
Document = apps.get_model('doc', 'Document')
24+
State = apps.get_model('doc','State')
25+
active = State.objects.get(type__slug='slides',slug='active')
26+
for doc in Document.objects.filter(name__startswith='slides-92-',states__type__slug='slides',states__slug='archived'):
27+
set_state(doc,active)
28+
29+
class Migration(migrations.Migration):
30+
31+
dependencies = [
32+
('doc', '0003_auto_20150326_0728'),
33+
]
34+
35+
operations = [
36+
migrations.RunPython(forward_archive_slides,reverse_archive_slides),
37+
]

ietf/doc/models.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -233,14 +233,13 @@ def active_ballot(self):
233233
return None
234234

235235
def meeting_related(self):
236-
if self.type_id in ("agenda","minutes","bluesheets"):
237-
return (self.name.split("-")[1] == "interim"
238-
or (self.session_set.exists() if isinstance(self, Document) else self.doc.session_set.exists()))
239-
elif self.type_id in ("slides",):
240-
return (self.name.split("-")[1] == "interim"
241-
or (self.get_state('slides') and self.get_state('slides').slug in ("active", "sessonly","archived") ))
242-
else:
243-
return False
236+
answer = False
237+
if self.type_id in ("agenda","minutes","bluesheets","slides"):
238+
answer = (self.name.split("-")[1] == "interim"
239+
or (self if isinstance(self, Document) else self.doc).session_set.exists())
240+
if self.type_id in ("slides",):
241+
answer = answer and self.get_state_slug('reuse_policy')=='single'
242+
return answer
244243

245244
def relations_that(self, relationship):
246245
"""Return the related-document objects that describe a given relationship targeting self."""
@@ -702,7 +701,7 @@ class DocEvent(models.Model):
702701
desc = models.TextField()
703702

704703
def for_current_revision(self):
705-
return self.time >= self.doc.time
704+
return self.time >= self.doc.latest_event(NewRevisionDocEvent,type='new_revision').time
706705

707706
def get_dochistory(self):
708707
return DocHistory.objects.filter(time__lte=self.time,doc__name=self.doc.name).order_by('-time').first()

ietf/doc/tests.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,11 @@
1414
from django.core.urlresolvers import reverse as urlreverse
1515
from django.conf import settings
1616

17+
import debug # pyflakes:ignore
18+
1719
from ietf.doc.models import ( Document, DocAlias, DocRelationshipName, RelatedDocument, State,
18-
DocEvent, BallotPositionDocEvent, LastCallDocEvent, WriteupDocEvent, save_document_in_history )
20+
DocEvent, BallotPositionDocEvent, LastCallDocEvent, WriteupDocEvent, NewRevisionDocEvent,
21+
save_document_in_history )
1922
from ietf.group.models import Group
2023
from ietf.meeting.models import Meeting, Session, SessionPresentation
2124
from ietf.name.models import SessionStatusName
@@ -534,6 +537,8 @@ def test_document_ballot(self):
534537
doc = make_test_data()
535538
ballot = doc.active_ballot()
536539

540+
save_document_in_history(doc)
541+
537542
pos = BallotPositionDocEvent.objects.create(
538543
doc=doc,
539544
ballot=ballot,
@@ -556,6 +561,16 @@ def test_document_ballot(self):
556561
# test popup too while we're at it
557562
r = self.client.get(urlreverse("ietf.doc.views_doc.ballot_popup", kwargs=dict(name=doc.name, ballot_id=ballot.pk)))
558563
self.assertEqual(r.status_code, 200)
564+
565+
# Now simulate a new revision and make sure positions on older revisions are marked as such
566+
oldrev = doc.rev
567+
e = NewRevisionDocEvent.objects.create(doc=doc,rev='%02d'%(int(doc.rev)+1),type='new_revision',by=Person.objects.get(name="(System)"))
568+
save_document_in_history(doc)
569+
doc.rev = e.rev
570+
doc.save()
571+
r = self.client.get(urlreverse("ietf.doc.views_doc.document_ballot", kwargs=dict(name=doc.name)))
572+
self.assertEqual(r.status_code, 200)
573+
self.assertTrue( '(%s for -%s)' % (pos.comment_time.strftime('%Y-%m-%d'), oldrev) in r.content)
559574

560575
def test_document_ballot_needed_positions(self):
561576
make_test_data()

ietf/doc/tests_material.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ def create_slides(self):
4343

4444
doc = Document.objects.create(name="slides-testteam-test-file", rev="01", type_id="slides", group=group)
4545
doc.set_state(State.objects.get(type="slides", slug="active"))
46+
doc.set_state(State.objects.get(type="reuse_policy", slug="multiple"))
4647
DocAlias.objects.create(name=doc.name, document=doc)
4748
NewRevisionDocEvent.objects.create(doc=doc,by=Person.objects.get(name="(System)"),rev='00',type='new_revision',desc='New revision available')
4849
NewRevisionDocEvent.objects.create(doc=doc,by=Person.objects.get(name="(System)"),rev='01',type='new_revision',desc='New revision available')
@@ -168,7 +169,7 @@ def test_revise(self):
168169
self.assertEqual(doc.title, "New title")
169170
self.assertEqual(doc.get_state_slug(), "active")
170171

171-
with open(os.path.join(self.agenda_dir, "42", "slides", doc.name + "-" + doc.rev + ".txt")) as f:
172+
with open(os.path.join(doc.get_file_path(), doc.name + "-" + doc.rev + ".txt")) as f:
172173
self.assertEqual(f.read(), content)
173174

174175
def test_material_presentations(self):

ietf/doc/views_doc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,7 @@ def document_main(request, name, rev=None):
539539
if doc.type_id in ("slides", "agenda", "minutes"):
540540
can_manage_material = can_manage_materials(request.user, doc.group)
541541
presentations = None
542-
if doc.type_id=='slides' and doc.get_state_slug('slides') in ['sessonly','active']:
542+
if doc.type_id=='slides' and doc.get_state_slug('slides')=='active' :
543543
presentations = doc.future_presentations()
544544
if doc.meeting_related():
545545
# disallow editing meeting-related stuff through this

ietf/group/models.py

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -38,24 +38,6 @@ def name_with_acronym(self):
3838
def ad_role(self):
3939
return self.role_set.filter(name='ad').first()
4040

41-
@property
42-
def ad(self):
43-
#assert(False) # These methods are deprecated - expect them to go away when the _ad field is removed
44-
ad_role = self.ad_role()
45-
return ad_role and ad_role.person
46-
47-
@ad.setter
48-
def ad(self,value):
49-
#assert(False)
50-
self.role_set.filter(name='ad').delete()
51-
if value:
52-
self.role_set.create(name=RoleName.objects.get(slug='ad'), person=value, email=value.role_email('ad'))
53-
54-
@property
55-
def ad_id(self):
56-
#assert(False)
57-
return self.ad.id
58-
5941
@property
6042
def features(self):
6143
if not hasattr(self, "features_cache"):

ietf/meeting/models.py

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -864,24 +864,16 @@ class Session(models.Model):
864864

865865
unique_constraints_dict = None
866866

867+
# Should work on how materials are captured so that deleted things are no longer associated with the session
868+
# (We can keep the information about something being added to and removed from a session in the document's history)
867869
def agenda(self):
868-
items = self.materials.filter(type="agenda",states__type="agenda",states__slug="active")
869-
if items and items[0] is not None:
870-
return items[0]
871-
else:
872-
return None
870+
return self.materials.filter(type='agenda').exclude(states__type='agenda',states__slug='deleted').first()
873871

874872
def minutes(self):
875-
try:
876-
return self.materials.get(type="minutes",states__type="minutes",states__slug="active")
877-
except Exception:
878-
return None
873+
return self.materials.filter(type='minutes').exclude(states__type='minutes',states__slug='deleted').first()
879874

880875
def slides(self):
881-
try:
882-
return self.materials.filter(type="slides",states__type="slides",states__slug="active").order_by("order")
883-
except Exception:
884-
return []
876+
return list(self.materials.filter(type='slides').exclude(states__type='slides',states__slug='deleted').order_by('order'))
885877

886878
def __unicode__(self):
887879
if self.meeting.type_id == "interim":

0 commit comments

Comments
 (0)