Files
Chad Whitacre 28cb48c72a Big changeover from id to username; #287
I sort of did this one with the blast shield down. I haven't even run
the tests yet. The sorts of things I changed:

 - SQL {elsewhere,exchanges}.participant_id => .participant
 - SQL participants.id => .username
 - ORM {user,participant,self}.id => .username
2013-04-05 15:48:59 -04:00

24 lines
495 B
JSON

from aspen import Response
from gittip import db
^L
if user.ANON:
raise Response(404)
request.allow("GET", "POST")
if POST:
rec = db.fetchone("""
UPDATE participants
SET anonymous=not anonymous
WHERE username=%s
RETURNING anonymous
""", (user.username,))
else:
rec = db.fetchone("""
SELECT anonymous FROM participants WHERE username=%s
""", (user.username,))
assert rec is not None
response.body = {"anonymous": rec['anonymous']}