mirror of
https://github.com/kennethreitz-archive/www.gittip.com.git
synced 2026-06-21 15:50:59 +00:00
24 lines
471 B
JSON
24 lines
471 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 id=%s
|
|
RETURNING anonymous
|
|
|
|
""", (user.id,))
|
|
else:
|
|
rec = db.fetchone("""
|
|
|
|
SELECT anonymous FROM participants WHERE id=%s
|
|
|
|
""", (user.id,))
|
|
assert rec is not None
|
|
response.body = {"anonymous": rec['anonymous']}
|