def Post(env, resp):
 input = env['wsgi.input']
 length = int(env.get('CONTENT_LENGTH', 0))
 if (length > 0):
  postdata = input.read(length)
  fields = cgi.parse_qs(postdata)
  content = fields['content'][0]
  content = content.strip()
  if content:
   forumdb.AddPost(content)
 headers = [('Location', '/'), ('Content-type', 'text/plain')]
 resp('302 REDIRECT', headers)
 return ['Redirecting']

def Post ( env , resp ) : input = env [ 'wsgi.input' ] length = int ( env . get ( 'CONTENT_LENGTH' , 0 ) ) if ( length > 0 ) : postdata = input . read ( length ) fields = cgi . parse_qs ( postdata ) content = fields [ 'content' ] [ 0 ] content = content . strip ( ) if content : forumdb . AddPost ( content ) headers = [ ( 'Location' , '/' ) , ( 'Content-type' , 'text/plain' ) ] resp ( '302 REDIRECT' , headers ) return [ 'Redirecting' ]
post handles a submission of the forums form .