#! /usr/bin/python import cgitb; cgitb.enable() import cgi import glob import os import sys import markdown BASE = '/var/lib/wishlists' f = cgi.FieldStorage() title = 'Wishlists' content = [] u = f.getfirst('u') p = f.getfirst('p') if u: if p: if p.lower() not in ('dingo', 'jada'): content.append("
I'm sorry but that is not the right answer.
") else: txt = f.getfirst('txt') open(os.path.join(BASE, u), 'w').write(txt) content.append('Okay, thanks!
') content.append('') else: title = "%s's Wishlist" % cgi.escape(u) txt = open(os.path.join(BASE, u)).read() content.append('') content.append('Formatting overview:
') content.append('* Item') content.append('* Second item') content.append('* Item with [a link](http://example.com/)') content.append('* <del>A spoken-for item</del>') else: for fn in sorted(glob.glob(os.path.join(BASE, '*'))): u = os.path.basename(fn) content.append("