3
from canonical.lp import initZopeless
4
from canonical.database import postgresql
5
from canonical.database.sqlbase import cursor
6
from canonical.launchpad.database import Person, TeamParticipation
8
person_handle = sys.argv[1]
13
if "@" in person_handle:
14
person = Person.selectOne("EmailAddress.person = Person.id AND "
15
"emailaddress.email = %s" % person_handle)
17
person = Person.selectOneBy(name=person_handle)
19
person = Person.selectOneBy(id=person_handle)
22
print "Person %s not found" % person_handle
28
references = list(postgresql.listReferences(cur, 'person', 'id'))
30
print ("Listing references for %s (ID %s, preferred email %s):\n" %
31
(person.name, person.id,
32
person.preferredemail and person.preferredemail.email))
33
for src_tab, src_col, ref_tab, ref_col, updact, delact in references:
34
if (src_tab, src_col) in skip:
36
query = "SELECT id FROM %s WHERE %s=%s" % (src_tab, src_col, person.id)
40
if src_tab.lower() == 'teamparticipation':
41
tp = TeamParticipation.selectOneBy(
42
personID=person.id, teamID=person.id)
44
# Every person has a teamparticipation entry for itself,
45
# and we already know this. No need to output it, then.
47
print ("\tColumn %s of table %s with id %s points to this "
48
"person." % (src_col, src_tab, row[0]))