Merge lp:~canonical-isd-hackers/canonical-identity-provider/emailaddress-person into lp:canonical-identity-provider/release

Proposed by Ricardo Kirkner
Status: Merged
Merged at revision: 9
Proposed branch: lp:~canonical-isd-hackers/canonical-identity-provider/emailaddress-person
Merge into: lp:canonical-identity-provider/release
Diff against target: 1010 lines (+136/-107)
7 files modified
identityprovider/models/emailaddress.py (+9/-1)
identityprovider/models/fixtures/lp_emailaddress_noperson.json (+90/-90)
identityprovider/models/fixtures/test.json (+8/-8)
identityprovider/tests/test_models_emailaddress.py (+21/-0)
identityprovider/tests/test_utils.py (+4/-4)
identityprovider/tests/test_views_ui.py (+3/-3)
identityprovider/views/account.py (+1/-1)
To merge this branch: bzr merge lp:~canonical-isd-hackers/canonical-identity-provider/emailaddress-person
Reviewer Review Type Date Requested Status
Łukasz Czyżykowski (community) Approve
Review via email: mp+24985@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Łukasz Czyżykowski (lukasz-czyzykowski) wrote :

Small and solid change.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'identityprovider/models/emailaddress.py'
2--- identityprovider/models/emailaddress.py 2010-04-21 15:29:24 +0000
3+++ identityprovider/models/emailaddress.py 2010-05-10 12:18:29 +0000
4@@ -15,7 +15,7 @@
5
6 class EmailAddress(models.Model):
7 email = models.TextField()
8- person = models.ForeignKey(Person, db_column='person',
9+ lp_person = models.ForeignKey(Person, db_column='person',
10 blank=True, null=True)
11 status = models.IntegerField(choices=EmailStatus._get_choices())
12 date_created = models.DateTimeField(default=datetime.datetime.utcnow,
13@@ -29,3 +29,11 @@
14
15 def __unicode__(self):
16 return self.email
17+
18+ @property
19+ def person(self):
20+ if self.account is not None:
21+ person = self.account.person
22+ else:
23+ person = self.lp_person
24+ return person
25
26=== modified file 'identityprovider/models/fixtures/lp_emailaddress_noperson.json'
27--- identityprovider/models/fixtures/lp_emailaddress_noperson.json 2010-04-21 15:29:24 +0000
28+++ identityprovider/models/fixtures/lp_emailaddress_noperson.json 2010-05-10 12:18:29 +0000
29@@ -4,7 +4,7 @@
30 "model": "identityprovider.emailaddress",
31 "fields": {
32 "status": 4,
33- "person": null,
34+ "lp_person": null,
35 "account": 1,
36 "email": "mark@example.com",
37 "date_created": "2006-10-16 18:31:43"
38@@ -15,7 +15,7 @@
39 "model": "identityprovider.emailaddress",
40 "fields": {
41 "status": 4,
42- "person": null,
43+ "lp_person": null,
44 "account": 2,
45 "email": "robertc@robertcollins.net",
46 "date_created": "2006-10-16 18:31:43"
47@@ -26,7 +26,7 @@
48 "model": "identityprovider.emailaddress",
49 "fields": {
50 "status": 4,
51- "person": null,
52+ "lp_person": null,
53 "account": 13,
54 "email": "carlos@canonical.com",
55 "date_created": "2006-10-16 18:31:43"
56@@ -37,7 +37,7 @@
57 "model": "identityprovider.emailaddress",
58 "fields": {
59 "status": 4,
60- "person": null,
61+ "lp_person": null,
62 "account": 14,
63 "email": "daf@canonical.com",
64 "date_created": "2006-10-16 18:31:43"
65@@ -48,7 +48,7 @@
66 "model": "identityprovider.emailaddress",
67 "fields": {
68 "status": 4,
69- "person": null,
70+ "lp_person": null,
71 "account": 16,
72 "email": "foo.bar@canonical.com",
73 "date_created": "2006-10-16 18:31:43"
74@@ -59,7 +59,7 @@
75 "model": "identityprovider.emailaddress",
76 "fields": {
77 "status": 4,
78- "person": null,
79+ "lp_person": null,
80 "account": 11,
81 "email": "steve.alexander@ubuntulinux.com",
82 "date_created": "2006-10-16 18:31:43"
83@@ -70,7 +70,7 @@
84 "model": "identityprovider.emailaddress",
85 "fields": {
86 "status": 4,
87- "person": null,
88+ "lp_person": null,
89 "account": 4,
90 "email": "colin.watson@ubuntulinux.com",
91 "date_created": "2006-10-16 18:31:43"
92@@ -81,7 +81,7 @@
93 "model": "identityprovider.emailaddress",
94 "fields": {
95 "status": 1,
96- "person": null,
97+ "lp_person": null,
98 "account": 5,
99 "email": "scott.james.remnant@ubuntulinux.com",
100 "date_created": "2006-10-16 18:31:43"
101@@ -92,7 +92,7 @@
102 "model": "identityprovider.emailaddress",
103 "fields": {
104 "status": 4,
105- "person": null,
106+ "lp_person": null,
107 "account": 7,
108 "email": "andrew.bennetts@ubuntulinux.com",
109 "date_created": "2006-10-16 18:31:43"
110@@ -103,7 +103,7 @@
111 "model": "identityprovider.emailaddress",
112 "fields": {
113 "status": 4,
114- "person": null,
115+ "lp_person": null,
116 "account": 8,
117 "email": "james.blackwell@ubuntulinux.com",
118 "date_created": "2006-10-16 18:31:43"
119@@ -114,7 +114,7 @@
120 "model": "identityprovider.emailaddress",
121 "fields": {
122 "status": 4,
123- "person": null,
124+ "lp_person": null,
125 "account": 9,
126 "email": "christian.reis@ubuntulinux.com",
127 "date_created": "2006-10-16 18:31:43"
128@@ -125,7 +125,7 @@
129 "model": "identityprovider.emailaddress",
130 "fields": {
131 "status": 4,
132- "person": null,
133+ "lp_person": null,
134 "account": 6,
135 "email": "jeff.waugh@ubuntulinux.com",
136 "date_created": "2006-10-16 18:31:43"
137@@ -136,7 +136,7 @@
138 "model": "identityprovider.emailaddress",
139 "fields": {
140 "status": 4,
141- "person": null,
142+ "lp_person": null,
143 "account": 3,
144 "email": "dave.miller@ubuntulinux.com",
145 "date_created": "2006-10-16 18:31:43"
146@@ -147,7 +147,7 @@
147 "model": "identityprovider.emailaddress",
148 "fields": {
149 "status": 1,
150- "person": null,
151+ "lp_person": null,
152 "account": 3,
153 "email": "justdave@bugzilla.org",
154 "date_created": "2006-10-16 18:31:43"
155@@ -158,7 +158,7 @@
156 "model": "identityprovider.emailaddress",
157 "fields": {
158 "status": 4,
159- "person": null,
160+ "lp_person": null,
161 "account": 12,
162 "email": "test@canonical.com",
163 "date_created": "2006-10-16 18:31:43"
164@@ -169,7 +169,7 @@
165 "model": "identityprovider.emailaddress",
166 "fields": {
167 "status": 1,
168- "person": null,
169+ "lp_person": null,
170 "account": 12,
171 "email": "testtest@canonical.com",
172 "date_created": "2006-10-16 18:31:43"
173@@ -180,7 +180,7 @@
174 "model": "identityprovider.emailaddress",
175 "fields": {
176 "status": 3,
177- "person": null,
178+ "lp_person": null,
179 "account": 12,
180 "email": "testtesttest@canonical.com",
181 "date_created": "2006-10-16 18:31:43"
182@@ -191,7 +191,7 @@
183 "model": "identityprovider.emailaddress",
184 "fields": {
185 "status": 2,
186- "person": null,
187+ "lp_person": null,
188 "account": 12,
189 "email": "testing@canonical.com",
190 "date_created": "2006-10-16 18:31:43"
191@@ -202,7 +202,7 @@
192 "model": "identityprovider.emailaddress",
193 "fields": {
194 "status": 4,
195- "person": null,
196+ "lp_person": null,
197 "account": 22,
198 "email": "stuart.bishop@canonical.com",
199 "date_created": "2006-10-16 18:31:43"
200@@ -213,7 +213,7 @@
201 "model": "identityprovider.emailaddress",
202 "fields": {
203 "status": 4,
204- "person": null,
205+ "lp_person": null,
206 "account": 23,
207 "email": "david.allouche@canonical.com",
208 "date_created": "2006-10-16 18:31:43"
209@@ -224,7 +224,7 @@
210 "model": "identityprovider.emailaddress",
211 "fields": {
212 "status": 2,
213- "person": null,
214+ "lp_person": null,
215 "account": 23,
216 "email": "david@canonical.com",
217 "date_created": "2006-10-16 18:31:43"
218@@ -235,7 +235,7 @@
219 "model": "identityprovider.emailaddress",
220 "fields": {
221 "status": 4,
222- "person": null,
223+ "lp_person": null,
224 "account": 27,
225 "email": "daniel.debonzi@canonical.com",
226 "date_created": "2006-10-16 18:31:43"
227@@ -246,7 +246,7 @@
228 "model": "identityprovider.emailaddress",
229 "fields": {
230 "status": 4,
231- "person": null,
232+ "lp_person": null,
233 "account": 28,
234 "email": "celso.providelo@canonical.com",
235 "date_created": "2006-10-16 18:31:43"
236@@ -257,7 +257,7 @@
237 "model": "identityprovider.emailaddress",
238 "fields": {
239 "status": 4,
240- "person": null,
241+ "lp_person": null,
242 "account": 29,
243 "email": "guilherme.salgado@canonical.com",
244 "date_created": "2006-10-16 18:31:43"
245@@ -268,7 +268,7 @@
246 "model": "identityprovider.emailaddress",
247 "fields": {
248 "status": 4,
249- "person": null,
250+ "lp_person": null,
251 "account": 33,
252 "email": "edgar@monteparadiso.hr",
253 "date_created": "2006-10-16 18:31:43"
254@@ -279,7 +279,7 @@
255 "model": "identityprovider.emailaddress",
256 "fields": {
257 "status": 1,
258- "person": null,
259+ "lp_person": null,
260 "account": 34,
261 "email": "jvprat@wanadoo.es",
262 "date_created": "2006-10-16 18:31:43"
263@@ -290,7 +290,7 @@
264 "model": "identityprovider.emailaddress",
265 "fields": {
266 "status": 1,
267- "person": null,
268+ "lp_person": null,
269 "account": 35,
270 "email": "sigurd-ubuntu@brogar.org",
271 "date_created": "2006-10-16 18:31:43"
272@@ -301,7 +301,7 @@
273 "model": "identityprovider.emailaddress",
274 "fields": {
275 "status": 1,
276- "person": null,
277+ "lp_person": null,
278 "account": 36,
279 "email": "skacel@svtech.cz",
280 "date_created": "2006-10-16 18:31:43"
281@@ -312,7 +312,7 @@
282 "model": "identityprovider.emailaddress",
283 "fields": {
284 "status": 1,
285- "person": null,
286+ "lp_person": null,
287 "account": 37,
288 "email": "danner@mixmail.com",
289 "date_created": "2006-10-16 18:31:43"
290@@ -323,7 +323,7 @@
291 "model": "identityprovider.emailaddress",
292 "fields": {
293 "status": 1,
294- "person": null,
295+ "lp_person": null,
296 "account": 38,
297 "email": "martin.pitt@canonical.com",
298 "date_created": "2006-10-16 18:31:43"
299@@ -334,7 +334,7 @@
300 "model": "identityprovider.emailaddress",
301 "fields": {
302 "status": 1,
303- "person": null,
304+ "lp_person": null,
305 "account": 39,
306 "email": "nsv@fr.st",
307 "date_created": "2006-10-16 18:31:43"
308@@ -345,7 +345,7 @@
309 "model": "identityprovider.emailaddress",
310 "fields": {
311 "status": 1,
312- "person": null,
313+ "lp_person": null,
314 "account": 40,
315 "email": "callipeo@libero.it",
316 "date_created": "2006-10-16 18:31:43"
317@@ -356,7 +356,7 @@
318 "model": "identityprovider.emailaddress",
319 "fields": {
320 "status": 1,
321- "person": null,
322+ "lp_person": null,
323 "account": 41,
324 "email": "jorge.gonzalez.gonzalez@hispalinux.es",
325 "date_created": "2006-10-16 18:31:43"
326@@ -367,7 +367,7 @@
327 "model": "identityprovider.emailaddress",
328 "fields": {
329 "status": 1,
330- "person": null,
331+ "lp_person": null,
332 "account": 42,
333 "email": "barbier@linuxfr.org",
334 "date_created": "2006-10-16 18:31:43"
335@@ -378,7 +378,7 @@
336 "model": "identityprovider.emailaddress",
337 "fields": {
338 "status": 1,
339- "person": null,
340+ "lp_person": null,
341 "account": 43,
342 "email": "andrelop@debian.org",
343 "date_created": "2006-10-16 18:31:43"
344@@ -389,7 +389,7 @@
345 "model": "identityprovider.emailaddress",
346 "fields": {
347 "status": 1,
348- "person": null,
349+ "lp_person": null,
350 "account": 44,
351 "email": "valyag@dat.etsit.upm.es",
352 "date_created": "2006-10-16 18:31:43"
353@@ -400,7 +400,7 @@
354 "model": "identityprovider.emailaddress",
355 "fields": {
356 "status": 1,
357- "person": null,
358+ "lp_person": null,
359 "account": 45,
360 "email": "luk.claes@ugent.be",
361 "date_created": "2006-10-16 18:31:43"
362@@ -411,7 +411,7 @@
363 "model": "identityprovider.emailaddress",
364 "fields": {
365 "status": 4,
366- "person": null,
367+ "lp_person": null,
368 "account": 46,
369 "email": "kurem@debian.cz",
370 "date_created": "2006-10-16 18:31:43"
371@@ -422,7 +422,7 @@
372 "model": "identityprovider.emailaddress",
373 "fields": {
374 "status": 1,
375- "person": null,
376+ "lp_person": null,
377 "account": 47,
378 "email": "morten@wtf.dk",
379 "date_created": "2006-10-16 18:31:43"
380@@ -433,7 +433,7 @@
381 "model": "identityprovider.emailaddress",
382 "fields": {
383 "status": 1,
384- "person": null,
385+ "lp_person": null,
386 "account": 48,
387 "email": "mpo@iki.fi",
388 "date_created": "2006-10-16 18:31:43"
389@@ -444,7 +444,7 @@
390 "model": "identityprovider.emailaddress",
391 "fields": {
392 "status": 1,
393- "person": null,
394+ "lp_person": null,
395 "account": 49,
396 "email": "kebil@kaunas.init.lt",
397 "date_created": "2006-10-16 18:31:43"
398@@ -455,7 +455,7 @@
399 "model": "identityprovider.emailaddress",
400 "fields": {
401 "status": 4,
402- "person": null,
403+ "lp_person": null,
404 "account": 50,
405 "email": "tsukimi@quaqua.net",
406 "date_created": "2006-10-16 18:31:43"
407@@ -466,7 +466,7 @@
408 "model": "identityprovider.emailaddress",
409 "fields": {
410 "status": 4,
411- "person": null,
412+ "lp_person": null,
413 "account": 51,
414 "email": "kreutzm@itp.uni-hannover.de",
415 "date_created": "2006-10-16 18:31:43"
416@@ -477,7 +477,7 @@
417 "model": "identityprovider.emailaddress",
418 "fields": {
419 "status": 4,
420- "person": null,
421+ "lp_person": null,
422 "account": null,
423 "email": "support@ubuntu.com",
424 "date_created": "2006-10-16 18:31:43"
425@@ -488,7 +488,7 @@
426 "model": "identityprovider.emailaddress",
427 "fields": {
428 "status": 4,
429- "person": null,
430+ "lp_person": null,
431 "account": 52,
432 "email": "no-priv@canonical.com",
433 "date_created": "2006-10-16 18:31:43"
434@@ -499,7 +499,7 @@
435 "model": "identityprovider.emailaddress",
436 "fields": {
437 "status": 2,
438- "person": null,
439+ "lp_person": null,
440 "account": 22,
441 "email": "stuart@stuartbishop.net",
442 "date_created": "2006-10-16 18:31:43"
443@@ -510,7 +510,7 @@
444 "model": "identityprovider.emailaddress",
445 "fields": {
446 "status": 3,
447- "person": null,
448+ "lp_person": null,
449 "account": 22,
450 "email": "zen@shangri-la.dropbear.id.au",
451 "date_created": "2006-10-16 18:31:43"
452@@ -521,7 +521,7 @@
453 "model": "identityprovider.emailaddress",
454 "fields": {
455 "status": 1,
456- "person": null,
457+ "lp_person": null,
458 "account": 22,
459 "email": "stub@fastmail.fm",
460 "date_created": "2006-10-16 18:31:43"
461@@ -532,7 +532,7 @@
462 "model": "identityprovider.emailaddress",
463 "fields": {
464 "status": 4,
465- "person": null,
466+ "lp_person": null,
467 "account": 55,
468 "email": "marilize@hbd.com",
469 "date_created": "2006-10-16 18:31:43"
470@@ -543,7 +543,7 @@
471 "model": "identityprovider.emailaddress",
472 "fields": {
473 "status": 4,
474- "person": null,
475+ "lp_person": null,
476 "account": 56,
477 "email": "jordi@ubuntu.com",
478 "date_created": "2006-10-16 18:31:43"
479@@ -554,7 +554,7 @@
480 "model": "identityprovider.emailaddress",
481 "fields": {
482 "status": 4,
483- "person": null,
484+ "lp_person": null,
485 "account": 26,
486 "email": "daniel.silverstone@canonical.com",
487 "date_created": "2006-10-16 18:31:43"
488@@ -565,7 +565,7 @@
489 "model": "identityprovider.emailaddress",
490 "fields": {
491 "status": 4,
492- "person": null,
493+ "lp_person": null,
494 "account": 58,
495 "email": "bug-importer@launchpad.net",
496 "date_created": "2006-10-16 18:31:43"
497@@ -576,7 +576,7 @@
498 "model": "identityprovider.emailaddress",
499 "fields": {
500 "status": 4,
501- "person": null,
502+ "lp_person": null,
503 "account": null,
504 "email": "rosetta@launchpad.net",
505 "date_created": "2006-10-16 18:31:43"
506@@ -587,7 +587,7 @@
507 "model": "identityprovider.emailaddress",
508 "fields": {
509 "status": 1,
510- "person": null,
511+ "lp_person": null,
512 "account": 29,
513 "email": "salgado@ubuntu.com",
514 "date_created": "2006-10-16 18:31:43"
515@@ -598,7 +598,7 @@
516 "model": "identityprovider.emailaddress",
517 "fields": {
518 "status": 2,
519- "person": null,
520+ "lp_person": null,
521 "account": 28,
522 "email": "cprov@ubuntu.com",
523 "date_created": "2006-10-16 18:31:43"
524@@ -609,7 +609,7 @@
525 "model": "identityprovider.emailaddress",
526 "fields": {
527 "status": 1,
528- "person": null,
529+ "lp_person": null,
530 "account": 62,
531 "email": "bugwatch@bugs.launchpad.net",
532 "date_created": "2006-10-16 18:31:43"
533@@ -620,7 +620,7 @@
534 "model": "identityprovider.emailaddress",
535 "fields": {
536 "status": 4,
537- "person": null,
538+ "lp_person": null,
539 "account": 63,
540 "email": "karl@canonical.com",
541 "date_created": "2006-10-16 18:31:43"
542@@ -631,7 +631,7 @@
543 "model": "identityprovider.emailaddress",
544 "fields": {
545 "status": 4,
546- "person": null,
547+ "lp_person": null,
548 "account": 10,
549 "email": "limi@plone.org",
550 "date_created": "2006-10-16 18:31:43"
551@@ -642,7 +642,7 @@
552 "model": "identityprovider.emailaddress",
553 "fields": {
554 "status": 4,
555- "person": null,
556+ "lp_person": null,
557 "account": 65,
558 "email": "janitor@launchpad.net",
559 "date_created": "2006-10-17 23:23:23"
560@@ -653,7 +653,7 @@
561 "model": "identityprovider.emailaddress",
562 "fields": {
563 "status": 1,
564- "person": null,
565+ "lp_person": null,
566 "account": 66,
567 "email": "matsubara@async.com.br",
568 "date_created": "2006-12-13 21:19:06"
569@@ -664,7 +664,7 @@
570 "model": "identityprovider.emailaddress",
571 "fields": {
572 "status": 4,
573- "person": null,
574+ "lp_person": null,
575 "account": 243602,
576 "email": "no-team-memberships@test.com",
577 "date_created": "2007-02-19 11:17:57"
578@@ -675,7 +675,7 @@
579 "model": "identityprovider.emailaddress",
580 "fields": {
581 "status": 4,
582- "person": null,
583+ "lp_person": null,
584 "account": 243603,
585 "email": "one-membership@test.com",
586 "date_created": "2007-02-21 10:53:59"
587@@ -686,7 +686,7 @@
588 "model": "identityprovider.emailaddress",
589 "fields": {
590 "status": 4,
591- "person": null,
592+ "lp_person": null,
593 "account": 68,
594 "email": "beta-admin@launchpad.net",
595 "date_created": "2007-01-31 06:56:25"
596@@ -697,7 +697,7 @@
597 "model": "identityprovider.emailaddress",
598 "fields": {
599 "status": 1,
600- "person": null,
601+ "lp_person": null,
602 "account": 243606,
603 "email": "launchpad@julian-edwards.com",
604 "date_created": "2007-08-09 21:25:37"
605@@ -708,7 +708,7 @@
606 "model": "identityprovider.emailaddress",
607 "fields": {
608 "status": 1,
609- "person": null,
610+ "lp_person": null,
611 "account": 243608,
612 "email": "doc@lists.ubuntu.com",
613 "date_created": "2007-11-12 15:23:19"
614@@ -719,7 +719,7 @@
615 "model": "identityprovider.emailaddress",
616 "fields": {
617 "status": 2,
618- "person": null,
619+ "lp_person": null,
620 "account": 13,
621 "email": "carlos@test.com",
622 "date_created": "2006-10-16 18:31:43"
623@@ -730,7 +730,7 @@
624 "model": "identityprovider.emailaddress",
625 "fields": {
626 "status": 4,
627- "person": null,
628+ "lp_person": null,
629 "account": 243609,
630 "email": "archive@ubuntu.com",
631 "date_created": "2007-12-07 13:43:20"
632@@ -741,7 +741,7 @@
633 "model": "identityprovider.emailaddress",
634 "fields": {
635 "status": 4,
636- "person": null,
637+ "lp_person": null,
638 "account": 243610,
639 "email": "member@canonical.com",
640 "date_created": "2007-12-14 16:52:15"
641@@ -752,7 +752,7 @@
642 "model": "identityprovider.emailaddress",
643 "fields": {
644 "status": 4,
645- "person": null,
646+ "lp_person": null,
647 "account": 243611,
648 "email": "owner@canonical.com",
649 "date_created": "2007-12-14 16:52:15"
650@@ -763,7 +763,7 @@
651 "model": "identityprovider.emailaddress",
652 "fields": {
653 "status": 1,
654- "person": null,
655+ "lp_person": null,
656 "account": 243614,
657 "email": "jbuhl_nospam@gmx.de",
658 "date_created": "2007-12-18 16:31:34"
659@@ -774,7 +774,7 @@
660 "model": "identityprovider.emailaddress",
661 "fields": {
662 "status": 1,
663- "person": null,
664+ "lp_person": null,
665 "account": 243615,
666 "email": "sjoerd@spring.luon.net",
667 "date_created": "2007-12-18 16:31:34"
668@@ -785,7 +785,7 @@
669 "model": "identityprovider.emailaddress",
670 "fields": {
671 "status": 1,
672- "person": null,
673+ "lp_person": null,
674 "account": 243616,
675 "email": "mpitt@debian.org",
676 "date_created": "2007-12-18 16:31:34"
677@@ -796,7 +796,7 @@
678 "model": "identityprovider.emailaddress",
679 "fields": {
680 "status": 4,
681- "person": null,
682+ "lp_person": null,
683 "account": 243617,
684 "email": "tim@canonical.com",
685 "date_created": "2008-03-06 09:55:27"
686@@ -807,7 +807,7 @@
687 "model": "identityprovider.emailaddress",
688 "fields": {
689 "status": 4,
690- "person": null,
691+ "lp_person": null,
692 "account": 243622,
693 "email": "commercial-member@canonical.com",
694 "date_created": "2008-05-12 17:38:38"
695@@ -818,7 +818,7 @@
696 "model": "identityprovider.emailaddress",
697 "fields": {
698 "status": 3,
699- "person": null,
700+ "lp_person": null,
701 "account": 70,
702 "email": "former-user@canonical.com",
703 "date_created": "2006-05-12 17:38:38"
704@@ -829,7 +829,7 @@
705 "model": "identityprovider.emailaddress",
706 "fields": {
707 "status": 4,
708- "person": null,
709+ "lp_person": null,
710 "account": 243623,
711 "email": "bac@canonical.com",
712 "date_created": "2008-06-27 14:49:11"
713@@ -840,7 +840,7 @@
714 "model": "identityprovider.emailaddress",
715 "fields": {
716 "status": 2,
717- "person": null,
718+ "lp_person": null,
719 "account": 16,
720 "email": "admin@canonical.com",
721 "date_created": "2008-08-05 12:01:32"
722@@ -851,7 +851,7 @@
723 "model": "identityprovider.emailaddress",
724 "fields": {
725 "status": 4,
726- "person": null,
727+ "lp_person": null,
728 "account": 243625,
729 "email": "ubuntu-branches-owner@example.com",
730 "date_created": "2009-03-17 07:28:15"
731@@ -862,7 +862,7 @@
732 "model": "identityprovider.emailaddress",
733 "fields": {
734 "status": 4,
735- "person": null,
736+ "lp_person": null,
737 "account": null,
738 "email": "guadamen@lists.launchpad.dev",
739 "date_created": "2009-06-24 00:34:34"
740@@ -873,7 +873,7 @@
741 "model": "identityprovider.emailaddress",
742 "fields": {
743 "status": 4,
744- "person": null,
745+ "lp_person": null,
746 "account": 243626,
747 "email": "techboard-owner@example.com",
748 "date_created": "2009-08-04 10:49:59"
749@@ -884,7 +884,7 @@
750 "model": "identityprovider.emailaddress",
751 "fields": {
752 "status": 4,
753- "person": null,
754+ "lp_person": null,
755 "account": 243627,
756 "email": "translations-deity@example.com",
757 "date_created": "2009-08-24 13:10:40"
758@@ -895,7 +895,7 @@
759 "model": "identityprovider.emailaddress",
760 "fields": {
761 "status": 4,
762- "person": null,
763+ "lp_person": null,
764 "account": 243628,
765 "email": "srba@example.com",
766 "date_created": "2009-08-24 14:09:47"
767@@ -906,7 +906,7 @@
768 "model": "identityprovider.emailaddress",
769 "fields": {
770 "status": 4,
771- "person": null,
772+ "lp_person": null,
773 "account": 243629,
774 "email": "joao@example.com",
775 "date_created": "2009-08-24 14:09:47"
776@@ -917,7 +917,7 @@
777 "model": "identityprovider.emailaddress",
778 "fields": {
779 "status": 4,
780- "person": null,
781+ "lp_person": null,
782 "account": 243630,
783 "email": "jurgen@example.com",
784 "date_created": "2009-08-24 14:09:48"
785@@ -928,7 +928,7 @@
786 "model": "identityprovider.emailaddress",
787 "fields": {
788 "status": 4,
789- "person": null,
790+ "lp_person": null,
791 "account": 243631,
792 "email": "dolores@example.com",
793 "date_created": "2009-08-24 14:09:48"
794@@ -939,7 +939,7 @@
795 "model": "identityprovider.emailaddress",
796 "fields": {
797 "status": 4,
798- "person": null,
799+ "lp_person": null,
800 "account": 243632,
801 "email": "ivan@example.com",
802 "date_created": "2009-08-24 14:18:51"
803@@ -950,7 +950,7 @@
804 "model": "identityprovider.emailaddress",
805 "fields": {
806 "status": 4,
807- "person": null,
808+ "lp_person": null,
809 "account": 243633,
810 "email": "juanita@example.com",
811 "date_created": "2009-08-24 14:19:05"
812@@ -961,7 +961,7 @@
813 "model": "identityprovider.emailaddress",
814 "fields": {
815 "status": 4,
816- "person": null,
817+ "lp_person": null,
818 "account": 243634,
819 "email": "epiphany-maintainer@example.com",
820 "date_created": "2009-08-24 14:36:04"
821@@ -972,7 +972,7 @@
822 "model": "identityprovider.emailaddress",
823 "fields": {
824 "status": 4,
825- "person": null,
826+ "lp_person": null,
827 "account": 243635,
828 "email": "intltool-maintainer@example.com",
829 "date_created": "2009-08-24 14:39:04"
830@@ -983,7 +983,7 @@
831 "model": "identityprovider.emailaddress",
832 "fields": {
833 "status": 4,
834- "person": null,
835+ "lp_person": null,
836 "account": 243636,
837 "email": "lies@example.com",
838 "date_created": "2009-08-24 14:41:04"
839
840=== modified file 'identityprovider/models/fixtures/test.json'
841--- identityprovider/models/fixtures/test.json 2010-04-21 15:29:24 +0000
842+++ identityprovider/models/fixtures/test.json 2010-05-10 12:18:29 +0000
843@@ -100,7 +100,7 @@
844 "model": "identityprovider.emailaddress",
845 "fields": {
846 "status": 4,
847- "person": null,
848+ "lp_person": null,
849 "account": 1,
850 "email": "mark@example.com",
851 "date_created": "2006-10-16 18:31:43"
852@@ -111,7 +111,7 @@
853 "model": "identityprovider.emailaddress",
854 "fields": {
855 "status": 4,
856- "person": 12,
857+ "lp_person": 12,
858 "account": 12,
859 "email": "test@canonical.com",
860 "date_created": "2006-10-16 18:31:43"
861@@ -122,7 +122,7 @@
862 "model": "identityprovider.emailaddress",
863 "fields": {
864 "status": 1,
865- "person": 12,
866+ "lp_person": 12,
867 "account": 12,
868 "email": "testtest@canonical.com",
869 "date_created": "2006-10-16 18:31:43.547829"
870@@ -133,7 +133,7 @@
871 "model": "identityprovider.emailaddress",
872 "fields": {
873 "status": 3,
874- "person": 12,
875+ "lp_person": 12,
876 "account": 12,
877 "email": "testtesttest@canonical.com",
878 "date_created": "2006-10-16 18:31:43.54821"
879@@ -144,7 +144,7 @@
880 "model": "identityprovider.emailaddress",
881 "fields": {
882 "status": 2,
883- "person": 12,
884+ "lp_person": 12,
885 "account": 12,
886 "email": "testing@canonical.com",
887 "date_created": "2006-10-16 18:31:43.548591"
888@@ -155,7 +155,7 @@
889 "model": "identityprovider.emailaddress",
890 "fields": {
891 "status": 4,
892- "person": 17,
893+ "lp_person": 17,
894 "account": null,
895 "email": "support@ubuntu.com",
896 "date_created": "2006-10-16 18:31:43.621341"
897@@ -166,7 +166,7 @@
898 "model": "identityprovider.emailaddress",
899 "fields": {
900 "status": 1,
901- "person": null,
902+ "lp_person": null,
903 "account": 66,
904 "email": "matsubara@async.com.br",
905 "date_created": "2006-12-13 21:19:06"
906@@ -177,7 +177,7 @@
907 "model": "identityprovider.emailaddress",
908 "fields": {
909 "status": 4,
910- "person": 243610,
911+ "lp_person": 243610,
912 "account": 243610,
913 "email": "member@canonical.com",
914 "date_created": "2007-12-14 16:52:15.403833"
915
916=== added file 'identityprovider/tests/test_models_emailaddress.py'
917--- identityprovider/tests/test_models_emailaddress.py 1970-01-01 00:00:00 +0000
918+++ identityprovider/tests/test_models_emailaddress.py 2010-05-10 12:18:29 +0000
919@@ -0,0 +1,21 @@
920+from identityprovider.models import Account, EmailAddress, Person
921+from identityprovider.tests.utils import BasicAccountTestCase
922+
923+
924+class EmailAddressTestCase(BasicAccountTestCase):
925+ fixtures = ['test']
926+
927+ def test_emailaddress_with_account_and_person(self):
928+ account = Account.objects.get_by_email('mark@example.com')
929+ email = EmailAddress.objects.get(email='mark@example.com')
930+ self.assertEqual(email.person, account.person)
931+
932+ def test_emailaddress_with_account_no_person(self):
933+ account = Account.objects.get_by_email('test@canonical.com')
934+ email = EmailAddress.objects.get(email='test@canonical.com')
935+ self.assertEqual(email.person, account.person)
936+
937+ def test_emailaddress_without_account(self):
938+ email = EmailAddress.objects.get(email='support@ubuntu.com')
939+ expected_person = Person.objects.get(pk=17)
940+ self.assertEqual(email.person, expected_person)
941
942=== modified file 'identityprovider/tests/test_utils.py'
943--- identityprovider/tests/test_utils.py 2010-04-21 15:29:24 +0000
944+++ identityprovider/tests/test_utils.py 2010-05-10 12:18:29 +0000
945@@ -34,7 +34,7 @@
946 def test_account_and_person_is_none(self):
947 email = EmailAddress.objects.get(email__iexact="mark@example.com")
948 email.account = None
949- email.person = None
950+ email.lp_person = None
951 email.save()
952
953 self.assertRaises(PersonAndAccountNotFoundException,
954@@ -46,8 +46,8 @@
955 def test_person_does_not_exist(self):
956 # create email address with broken foreign key
957 email = EmailAddress.objects.get(email__iexact='mark@example.com')
958- person_id = email.person_id
959- email.person_id = 0
960+ lp_person_id = email.lp_person_id
961+ email.lp_person_id = 0
962 email.save()
963
964 # test method
965@@ -55,7 +55,7 @@
966 self.assertEquals(None, person)
967
968 # restore model integrity
969- email.person_id = person_id
970+ email.lp_person_id = lp_person_id
971 email.save()
972
973
974
975=== modified file 'identityprovider/tests/test_views_ui.py'
976--- identityprovider/tests/test_views_ui.py 2010-04-21 15:29:24 +0000
977+++ identityprovider/tests/test_views_ui.py 2010-05-10 12:18:29 +0000
978@@ -441,8 +441,8 @@
979 def test_new_account_when_person_does_not_exist(self):
980 # create email address with broken foreign key
981 email = EmailAddress.objects.get(email__iexact='mark@example.com')
982- person_id = email.person_id
983- email.person_id = 0
984+ lp_person_id = email.lp_person_id
985+ email.lp_person_id = 0
986 email.save()
987
988 # test normal workflow
989@@ -450,7 +450,7 @@
990 self.assertRedirects(r, '/+email-sent')
991
992 # restore model integrity
993- email.person_id = person_id
994+ email.lp_person_id = lp_person_id
995 email.save()
996
997
998
999=== modified file 'identityprovider/views/account.py'
1000--- identityprovider/views/account.py 2010-04-21 15:29:24 +0000
1001+++ identityprovider/views/account.py 2010-05-10 12:18:29 +0000
1002@@ -86,7 +86,7 @@
1003 status=EmailStatus.NEW).delete()
1004
1005 # Ensure that this account has such email address; return value is not used
1006- account.emailaddress_set.get_or_create(email=email, person=account.person,
1007+ account.emailaddress_set.get_or_create(email=email, lp_person=account.person,
1008 status=EmailStatus.NEW)
1009
1010 redirection_url = redirection_url_for_token(tokenid)