Skip to content

Commit

Permalink
Added section headers.
Browse files Browse the repository at this point in the history
  • Loading branch information
jimjshields committed Feb 9, 2015
1 parent 90b4908 commit aeaf7b6
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tiny.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

import cgi

### Server and run script ###

def wsgiref_server(app, host='', port=8080):
"""Implements a WSGIref server and serves continuously.
Can override default host and port if desired."""
Expand All @@ -26,6 +28,8 @@ def run_app(app):

wsgiref_server(app)

### Request Handler ###

def request_handler(environ, start_response):
"""This runs when the client makes a request. The server got the environ
from the client when the client made the request and is passing it to
Expand Down Expand Up @@ -69,6 +73,8 @@ def request_handler(environ, start_response):
content = URLS[request.path]()
return [content]

### Request Class ###

class Request(object):
"""Represents a request object. It is initialized upon starting the app.
When a user makes a request, it will bind user's request information
Expand Down Expand Up @@ -116,6 +122,8 @@ def post(self):

# TODO: Better routing

### Routing ###

def index():
return 'Home'

Expand All @@ -127,6 +135,8 @@ def user(user_name=''):

# TODO: Better URL handling

### URLs ###

URLS = {
'/index': index,
'/': index,
Expand Down

0 comments on commit aeaf7b6

Please sign in to comment.