From f4f5053170a6bf8e45c15ea0435b86f5fa1b6d06 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 12 Nov 2003 21:41:46 +0000 Subject: initial commit git-svn-id: file:///home/lennart/svn/public/syrep-chub/trunk@2 4c8cc7d0-f3cb-0310-ad32-ddc431b48844 --- sch.py | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 sch.py (limited to 'sch.py') diff --git a/sch.py b/sch.py new file mode 100644 index 0000000..395cf1e --- /dev/null +++ b/sch.py @@ -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 'syrep-chub: %s

%s

' % (t, t) + header_done = 1 + +def print_footer(): + print '' + print '' + +def error(s): + global header_done + + if not header_done: + print_header("Error"); + + print '
%s
' % cgi.escape(s) + print_footer(); + sys.exit(0); + +def run_proc(p): + print '
'
+    fds = os.popen4(p, "r")
+
+    for ln in fds[1]:
+        print cgi.escape(ln),
+
+    fds[0].close()
+    fds[1].close()
+        
+    print '
' + + +def valid_fname(fn): + + if fn.find("/") >= 0: + return 0 + + return 1 -- cgit