Source

GtugGoSandbox / mapgame / view.py

Full commit
from google.appengine.api import users
from google.appengine.ext import webapp
from django.utils import simplejson

class CheckAuth(webapp.RequestHandler):
    def get(self):
        auth_data = dict(user=None,
                         link=None)
        user = users.get_current_user()

        if user:
            auth_data["user"] = user.email()
            auth_data["link"] = users.create_logout_url("/")
        else:
            auth_data["link"] = users.create_login_url("/")

        self.response.headers["Content-Type"] = "application/json"
        self.response.out.write(simplejson.dumps(auth_data))