[794] | 1 | #! /usr/bin/python |
---|
| 2 | |
---|
| 3 | # PyKota Print Quota Reports generator |
---|
| 4 | # |
---|
[952] | 5 | # PyKota - Print Quotas for CUPS and LPRng |
---|
[794] | 6 | # |
---|
| 7 | # (c) 2003 Jerome Alet <alet@librelogiciel.com> |
---|
[873] | 8 | # This program is free software; you can redistribute it and/or modify |
---|
| 9 | # it under the terms of the GNU General Public License as published by |
---|
| 10 | # the Free Software Foundation; either version 2 of the License, or |
---|
| 11 | # (at your option) any later version. |
---|
[794] | 12 | # |
---|
[873] | 13 | # This program is distributed in the hope that it will be useful, |
---|
| 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 16 | # GNU General Public License for more details. |
---|
| 17 | # |
---|
| 18 | # You should have received a copy of the GNU General Public License |
---|
| 19 | # along with this program; if not, write to the Free Software |
---|
| 20 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. |
---|
[794] | 21 | # |
---|
| 22 | # $Id$ |
---|
| 23 | # |
---|
| 24 | # $Log$ |
---|
[1048] | 25 | # Revision 1.7 2003/06/30 12:46:15 jalet |
---|
| 26 | # Extracted reporting code. |
---|
| 27 | # |
---|
[952] | 28 | # Revision 1.6 2003/04/23 22:13:56 jalet |
---|
| 29 | # Preliminary support for LPRng added BUT STILL UNTESTED. |
---|
| 30 | # |
---|
[941] | 31 | # Revision 1.5 2003/04/17 21:30:09 jalet |
---|
| 32 | # Now includes the logo |
---|
| 33 | # |
---|
[893] | 34 | # Revision 1.4 2003/04/08 21:20:25 jalet |
---|
| 35 | # CGI Script now displays a link to PyKota's website. |
---|
| 36 | # |
---|
[873] | 37 | # Revision 1.3 2003/03/29 13:45:27 jalet |
---|
| 38 | # GPL paragraphs were incorrectly (from memory) copied into the sources. |
---|
| 39 | # Two README files were added. |
---|
| 40 | # Upgrade script for PostgreSQL pre 1.01 schema was added. |
---|
| 41 | # |
---|
[799] | 42 | # Revision 1.2 2003/02/12 11:31:51 jalet |
---|
| 43 | # doesn't use the jaxml module anymore |
---|
| 44 | # |
---|
[794] | 45 | # Revision 1.1 2003/02/10 13:41:38 jalet |
---|
| 46 | # repykota cgi script added. |
---|
| 47 | # cleaner doc. |
---|
| 48 | # |
---|
| 49 | |
---|
| 50 | import sys |
---|
| 51 | import os |
---|
| 52 | import cgi |
---|
| 53 | |
---|
[1048] | 54 | from pykota import version |
---|
| 55 | from pykota.tool import PyKotaTool, PyKotaToolError |
---|
| 56 | from pykota.config import PyKotaConfigError |
---|
| 57 | from pykota.storage import PyKotaStorageError |
---|
| 58 | |
---|
[799] | 59 | header = """Content-type: text/html |
---|
[794] | 60 | |
---|
[799] | 61 | <?xml version="1.0" encoding="iso-8859-1"?> |
---|
| 62 | <html> |
---|
| 63 | <head> |
---|
| 64 | <title>Print Quota Report</title> |
---|
| 65 | </head> |
---|
| 66 | <body> |
---|
| 67 | <h2>Print Quota Report</h2> |
---|
[893] | 68 | <p> |
---|
| 69 | <pre>""" |
---|
[794] | 70 | |
---|
[799] | 71 | footer = """ |
---|
[893] | 72 | </pre> |
---|
| 73 | </p> |
---|
| 74 | <p> |
---|
[941] | 75 | <a href="http://www.librelogiciel.com/software/"><img src="http://www.librelogiciel.com/software/PyKota/calllogo" /></a> |
---|
| 76 | <br /> |
---|
[893] | 77 | Report generated with <a href="http://www.librelogiciel.com/software/">PyKota</a> |
---|
| 78 | </p> |
---|
[799] | 79 | </body> |
---|
| 80 | </html>""" |
---|
[794] | 81 | |
---|
[799] | 82 | print header |
---|
[794] | 83 | |
---|
| 84 | out = os.popen("repykota") |
---|
[799] | 85 | print out.read().strip() |
---|
[794] | 86 | out.close() |
---|
| 87 | |
---|
[799] | 88 | print footer |
---|