]> git.pld-linux.org Git - projects/pld-ftp-admin.git/blame - cgi-bin/index.py
Switch to Python 3 for rpm.org rpm
[projects/pld-ftp-admin.git] / cgi-bin / index.py
CommitLineData
a1e62e44 1#!/usr/bin/env python3
1610d209
MM
2# vi: encoding=utf-8 ts=8 sts=4 sw=4 et
3
2ec96333
JR
4from __future__ import print_function
5
1610d209
MM
6# Printing errors (no SyntaxErrors though, but that's not a problem)
7import sys, os
8sys.stderr=sys.stdout
9
10contenttypesent=False
11
12def 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 22sys.excepthook=myexceptionhandler
1610d209
MM
23# End printing errors
24
26f8b573 25sys.path.insert(0, '../modules')
1610d209
MM
26
27import wwwiface, user
28
29opts, cks = wwwiface.getopts()
30u=user.User(cks, opts)
31
32if 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
37else:
38 wwwiface.addheader('Login form')
39 wwwiface.addcontent(file='regform')
40
41wwwiface.sendhttpheaders()
42contenttypesent=True
43
44wwwiface.sendhtml()
45
This page took 0.852231 seconds and 4 git commands to generate.