businesstrips/index.py

29 lines
899 B
Python
Raw Normal View History

2014-04-18 23:43:54 +04:00
'''
Created on 29.11.2010
@author: morozov
'''
import os, sys, cgitb
serverdir = os.path.dirname(__file__)
sys.path.append(serverdir + os.sep + 'include')
import functions
import database
import webInterface
cgitb.enable()
config = functions.readConfig()
def application(environ, start_response):
db = database.dbOperations(dbname = config.mysql_database, user = config.mysql_user, password = config.mysql_password, host = config.mysql_server, port = int(config.mysql_port))
pageParts = webInterface.pageParts(environ, db)
output = pageParts.header()
output += pageParts.journalForDay()
output += pageParts.addRecord()
output += pageParts.footer()
db.close()
status = '200 OK'
response_headers = [('Content-type', 'text/html'),
('Content-Length', str(len(output)))]
start_response(status, response_headers)
return([output])