Entry 3087

GAE-hello

   

Submitted by anonymous on Jan. 25, 2010 at 11:21 a.m.
Language: Python. Code size: 764 bytes.

#!/usr/bin/env python

from google.appengine.ext import webapp
from google.appengine.ext.webapp import util

from google.appengine.api import users

class MainHandler(webapp.RequestHandler):

  def get(self):
       user = users.get_current_user()
       if not user:
           resp = ("Welcome to HelloWorld &mdash; please <a href='%s'>authorise</a> to continue" 
                      % users.create_login_url("/"))
       else:
           resp = "Dear %s, thanks for authorising!" % user.nickname()

       self.response.out.write(resp)

def main():
  application = webapp.WSGIApplication([('/', MainHandler)],
                                       debug=True)
  util.run_wsgi_app(application)


if __name__ == '__main__':
  main()

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).