Switch to a multi-request/response API to make batching possible.
This commit is contained in:
@@ -36,7 +36,7 @@ def google_user_xsrf_protection(handler):
|
||||
if not google_user:
|
||||
return handler(self)
|
||||
|
||||
google_user_id = auth.Parse(self.request.get('google_user_id', None))
|
||||
google_user_id = auth.Parse(self.request_json.get('google_user_id', None))
|
||||
if (not google_user_id or
|
||||
google_user_id != google_user.user_id()):
|
||||
return {
|
||||
|
||||
@@ -65,7 +65,7 @@ def session_required(handler):
|
||||
|
||||
@functools.wraps(handler)
|
||||
def FindOrCreateSession(self):
|
||||
client_key = auth.ParseKey(self.request.get('client_id', None))
|
||||
client_key = auth.ParseKey(self.request_json.get('client_id', None))
|
||||
|
||||
# The hunt for a Profile begins.
|
||||
if client_key:
|
||||
@@ -77,7 +77,7 @@ def session_required(handler):
|
||||
|
||||
ret = {
|
||||
'status': 'ok',
|
||||
'response': handler(self),
|
||||
'responses': handler(self),
|
||||
}
|
||||
if client_key != self.client.key():
|
||||
# Tell the client that this changed
|
||||
|
||||
10
lib/utils.py
10
lib/utils.py
@@ -25,6 +25,16 @@ from cosmopolite import config
|
||||
from cosmopolite.lib import auth
|
||||
|
||||
|
||||
def expects_json(handler):
|
||||
|
||||
@functools.wraps(handler)
|
||||
def ParseInput(self):
|
||||
self.request_json = json.load(self.request.body_file)
|
||||
return handler(self)
|
||||
|
||||
return ParseInput
|
||||
|
||||
|
||||
def returns_json(handler):
|
||||
|
||||
@functools.wraps(handler)
|
||||
|
||||
Reference in New Issue
Block a user