]>
Commit | Line | Data |
---|---|---|
1610d209 MM |
1 | #!/usr/bin/env python |
2 | # vi: encoding=utf-8 ts=8 sts=4 sw=4 et | |
3 | ||
4 | # Printing errors (no SyntaxErrors though, but that's not a problem) | |
5 | import sys, os | |
6 | sys.stderr=sys.stdout | |
7 | ||
8 | contenttypesent=False | |
9 | ||
10 | def myexceptionhandler(type, value, traceback): | |
11 | if contenttypesent: | |
12 | print '<pre>' | |
13 | sys.__excepthook__(type, value, traceback) | |
14 | print '</pre>' | |
15 | else: | |
16 | print "Content-Type: text/plain\n" | |
17 | sys.__excepthook__(type, value, traceback) | |
18 | sys.exit(1) | |
19 | ||
b0253fd1 | 20 | sys.excepthook=myexceptionhandler |
1610d209 MM |
21 | # End printing errors |
22 | ||
26f8b573 | 23 | sys.path.insert(0, '../modules') |
1610d209 MM |
24 | |
25 | import wwwiface, user | |
26 | ||
27 | opts, cks = wwwiface.getopts() | |
28 | u=user.User(cks, opts) | |
29 | ||
30 | if u.loggedin: | |
1610d209 MM |
31 | wwwiface.addheader('Logged in: '+u.login) |
32 | wwwiface.addmenu(file='loggedinmenu') | |
db087717 MM |
33 | import wwwcmds |
34 | wwwcmds.handlecmds(opts) | |
1610d209 MM |
35 | else: |
36 | wwwiface.addheader('Login form') | |
37 | wwwiface.addcontent(file='regform') | |
38 | ||
39 | wwwiface.sendhttpheaders() | |
40 | contenttypesent=True | |
41 | ||
42 | wwwiface.sendhtml() | |
43 |