businesstrips/print.py

29 lines
879 B
Python

'''
Created on 20.12.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.headerPrint()
output += pageParts.journalForDayPrint()
output += pageParts.footerPrint()
db.close()
status = '200 OK'
response_headers = [('Content-type', 'text/html'),
('Content-Length', str(len(output)))]
start_response(status, response_headers)
return([output])