mirror of
https://github.com/kennethreitz-archive/www.gittip.com.git
synced 2026-06-21 15:50:59 +00:00
28cb48c72a
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
24 lines
495 B
JSON
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']}
|