Sample GSD App

"""Record and display shout outs for the life of the server."""

import gsd

<title>Shout Outs!</title>
<form action="/" method="get">
<input name="shout">
<input type="submit" value="Shout!">
for shout in self.shout_outs:
print shout, '<br>'

class ShoutOuts(gsd.App):

"""A simple GSD app that records shout outs for the life of the server."""

def __init__(self):
self.shout_outs = []

def GET_(self, shout=None):
"""Display shout outs and form to add new ones."""
if shout is not None:
self.Render(TEMPLATE, locals())

def GET_reset(self):
"""Reset the list of shoutouts."""
self.shout_outs = []

if __name__ == '__main__':
app = ShoutOuts()
print 'http://localhost:8000/'
app.Serve('localhost', 8000)

No comments:

Post a Comment