Skip to content

Commit 594684a

Browse files
committed
Fixed a problem with the fill_in_shepherd_email migration, even if it has been run (and things cleaned up), just in case it might be needed or viewed as a pattern later.
- Legacy-Id: 8503
1 parent e3077c6 commit 594684a

1 file changed

Lines changed: 11 additions & 8 deletions

File tree

ietf/doc/migrations/0022_fill_in_shepherd_email.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
# -*- coding: utf-8 -*-
1+
# -*- coding: utf-8 -*-
22
from south.v2 import DataMigration
3+
import debug
34

45
class Migration(DataMigration):
56

@@ -9,14 +10,16 @@ def forwards(self, orm):
910
shepherds.update(orm.DocHistory.objects.values_list("shepherd", flat=True).distinct())
1011

1112
for person_id in shepherds:
12-
emails = orm['person.Email'].objects.filter(person=person_id).order_by("-active", "-time")[:1]
13-
if not emails:
14-
print "ERROR: no emails for", person_id
13+
if not person_id is None:
14+
emails = orm['person.Email'].objects.filter(person=person_id).order_by("-active", "-time")[:1]
15+
if not emails:
16+
print "ERROR: no emails for", person_id
17+
continue
18+
19+
email = emails[0]
1520

16-
email = emails[0]
17-
18-
orm.Document.objects.filter(shepherd=person_id, shepherd_email=None).update(shepherd_email=email)
19-
orm.DocHistory.objects.filter(shepherd=person_id, shepherd_email=None).update(shepherd_email=email)
21+
orm.Document.objects.filter(shepherd=person_id, shepherd_email=None).update(shepherd_email=email)
22+
orm.DocHistory.objects.filter(shepherd=person_id, shepherd_email=None).update(shepherd_email=email)
2023

2124
def backwards(self, orm):
2225
pass

0 commit comments

Comments
 (0)