Lists and Items‎ > ‎

Step 5: Handler Map

< Previous Step Next Step >

There is a section of code that maps incoming requests to the handlers

As per GAE's default webapp WSGI framework, there's a mapping, at the end of, between our defined URL regex's and our request handlers. So the end of every main web application module in GAE-land looks like this:

application = webapp.WSGIApplication(
[('/', HomePage),
('/list_form/', CreateList),
('/create_list/', CreateList),
('/item_form/(.*)/', CreateItem),
('/create_item/', CreateItem)],

def main():

if __name__ == "__main__":

A critically important feature used here, relative to passing keys in a Python/GAE implementation, is the "(.*)" in the regex. This passes the contents of that URL sub-string (a key passed back from the user) as an argument to CreateItem's CGI GET handler. In two steps, you'll see this assigned to the variable "list_key" inside CreateItem.get.