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