diff options
author | Lennart Poettering <lennart@poettering.net> | 2003-11-12 21:41:46 +0000 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2003-11-12 21:41:46 +0000 |
commit | f4f5053170a6bf8e45c15ea0435b86f5fa1b6d06 (patch) | |
tree | a7353540ccbb8550d2889e8911ff331cabe018e2 /sch.py | |
parent | 8c4fde5b8f3ea7148cd3ad85c87f2c99a94e77da (diff) |
initial commit
git-svn-id: file:///home/lennart/svn/public/syrep-chub/trunk@2 4c8cc7d0-f3cb-0310-ad32-ddc431b48844
Diffstat (limited to 'sch.py')
-rw-r--r-- | sch.py | 49 |
1 files changed, 49 insertions, 0 deletions
@@ -0,0 +1,49 @@ + +import cgi, sys, os + +repository_directory = "./rep" + +header_done = 0 + +def print_header(s): + global header_done + print "Content-Type: text/html" + print + + t = cgi.escape(s) + print '<html><head><title>syrep-chub: %s</title><link rel="stylesheet" type="text/css" href="style.css"></head><body><h1>%s</h1>' % (t, t) + header_done = 1 + +def print_footer(): + print '<div class="copyright">© Lennart Poettering 2003</div>' + print '</body></html>' + +def error(s): + global header_done + + if not header_done: + print_header("Error"); + + print '<div class="error">%s</div>' % cgi.escape(s) + print_footer(); + sys.exit(0); + +def run_proc(p): + print '<pre>' + fds = os.popen4(p, "r") + + for ln in fds[1]: + print cgi.escape(ln), + + fds[0].close() + fds[1].close() + + print '</pre>' + + +def valid_fname(fn): + + if fn.find("/") >= 0: + return 0 + + return 1 |