4: Render and Handler Shells

< Previous Step Next Step >

The classes for handlers and page renderers have explicit arguments.

Use is made here of the Google App Engine webapp framework ... with which the handler classes become subclasses of webapp.RequestHandler. This needs to be added to the import list:

from google.appengine.ext import webapp

The GET requests for all actions will pass keys to create a form, and these will be in the parameter list for the get methods.

The render functions for each page will be passed a dictionaries of template_values.

The functional centers now look like this:

# splash page

def splash_page_render(template_values):
# access to splash_page.html django template

class SplashPage(webapp.RequestHandler):
def get(self):

# login / logout pages

class LoginPage(webapp.RequestHandler):
def get(self):

class LogoutPage(webapp.RequestHandler):
def get(self):

# user page def user_page_render(template_values): # access to user_page.html django template pass class UserPage(webapp.RequestHandler): def get(self): pass class CreateGroup(webapp.RequestHandler): def get(self): pass
# admin page def admin_page_render(template_values): # access to admin_page.html django template pass class AdminPage(webapp.RequestHandler): def get(self): pass
# group page def group_page_render(template_values): # access to group_page.html django template pass class GroupPage(webapp.RequestHandler): def get(self): # state switch: user's membership in group pass class CreateGroup(webapp.RequestHandler): def get(self, key): pass class JoinGroup(webapp.RequestHandler): def get(self, key): pass class LeaveGroup(webapp.RequestHandler): def get(self, key): pass
# text sections class TextSectionAddEdit(webapp.RequestHandler): def get(self, key): # add - renders the home page with a # Text form, populateed on edit pass def post(self): # add - handles the CGI POST to # add or update a Text section pass class TextSectionDelete(webapp.RequestHandler): def get(self, key): # delete - deletes a text section pass