Index: pykota/trunk/pykota/tool.py
===================================================================
--- pykota/trunk/pykota/tool.py (revision 2146)
+++ pykota/trunk/pykota/tool.py (revision 2147)
@@ -20,529 +20,4 @@
 #
 # $Id$
-#
-# $Log$
-# Revision 1.151  2005/02/22 17:56:58  jalet
-# Now logs the type of user running the command : mere mortal vs PyKota Admin
-#
-# Revision 1.150  2005/02/14 22:53:44  jalet
-# Now always precomputes the job's size with the internal PDL parser, and not
-# only when 'enforcement: strict' was set in pykota.conf
-#
-# Revision 1.149  2005/02/13 22:02:29  jalet
-# Big database structure changes. Upgrade script is now included as well as
-# the new LDAP schema.
-# Introduction of the -o | --overcharge command line option to edpykota.
-# The output of repykota is more complete, but doesn't fit in 80 columns anymore.
-# Introduction of the new 'maxdenybanners' directive.
-#
-# Revision 1.148  2005/01/06 23:24:21  jalet
-# Regain priviledge the time to open the job's data file when printing in
-# raw mode with CUPS.
-#
-# Revision 1.147  2005/01/06 22:52:53  jalet
-# Implemented the dropping of priviledges. Beware, beware...
-#
-# Revision 1.146  2004/12/09 23:03:57  jalet
-# Fixed a bug when pkbanner's output was piped into another command (e.g. gs)
-#
-# Revision 1.145  2004/11/27 22:52:07  jalet
-# Now PyKota searches its configuration files first in system user pykota's
-# home directory
-#
-# Revision 1.144  2004/11/18 06:01:53  jalet
-# Fix for the fix
-#
-# Revision 1.143  2004/11/18 05:54:15  jalet
-# Fix problem with spaces at the end of filenames in LPRng
-#
-# Revision 1.142  2004/11/16 23:15:05  jalet
-# Fix for LPRng job's file detection code
-#
-# Revision 1.141  2004/11/15 22:01:34  jalet
-# Improved banner handling.
-# Fix for raw printing and banners.
-#
-# Revision 1.140  2004/11/15 19:59:34  jalet
-# PyKota banners now basically work !
-#
-# Revision 1.139  2004/11/15 15:54:03  jalet
-# Continued integration of Matt's patch for banners
-#
-# Revision 1.138  2004/11/12 23:46:44  jalet
-# Heavy work on pkbanner. Not finished yet though, but mostly works.
-#
-# Revision 1.137  2004/11/01 16:21:17  jalet
-# Little change for locale+gettext
-#
-# Revision 1.136  2004/10/24 09:06:46  jalet
-# Added debug messages for LPRng support possible problem ???
-#
-# Revision 1.135  2004/10/20 14:29:30  jalet
-# Now logs something when locale settings are incorrect.
-#
-# Revision 1.134  2004/10/20 08:12:27  jalet
-# Another fix for charset detection and Python2.3
-#
-# Revision 1.133  2004/10/19 22:24:00  jalet
-# Should fix the printer's hostname or IP address detection code.
-#
-# Revision 1.132  2004/10/19 21:45:25  jalet
-# Now correctly logs command line arguments
-#
-# Revision 1.131  2004/10/19 21:37:57  jalet
-# Fixes recently introduced bug
-#
-# Revision 1.130  2004/10/19 15:21:48  jalet
-# Fixed incorrect setting of the user's locale
-#
-# Revision 1.129  2004/10/13 20:51:27  jalet
-# Made debugging levels be the same in cupspykota and lprngpykota.
-# Now outputs more information in informational messages : user, printer, jobid
-#
-# Revision 1.128  2004/10/11 22:53:06  jalet
-# Postponed string interpolation to help message's output method
-#
-# Revision 1.127  2004/10/11 12:48:38  jalet
-# Adds fake translation marker
-#
-# Revision 1.126  2004/10/05 09:41:13  jalet
-# Small fix for errors caused by unknown locale
-#
-# Revision 1.125  2004/10/04 11:18:10  jalet
-# Now exports the MD5 sum of the job's datas as an hexadecimal digest
-#
-# Revision 1.124  2004/10/02 05:48:56  jalet
-# Should now correctly deal with charsets both when storing into databases and when
-# retrieving datas. Works with both PostgreSQL and LDAP.
-#
-# Revision 1.123  2004/09/29 20:20:52  jalet
-# Added the winbind_separator directive to pykota.conf to allow the admin to
-# strip out the Samba/Winbind domain name when users print.
-#
-# Revision 1.122  2004/09/28 21:38:56  jalet
-# Now computes the job's datas MD5 checksum to later forbid duplicate print jobs.
-# The checksum is not yet saved into the database.
-#
-# Revision 1.121  2004/09/15 18:47:58  jalet
-# Re-Extends the list of invalid characters in names to prevent
-# people from adding user "*" for example, or to prevent
-# print administrators to hijack the system by putting dangerous
-# datas into the database which would cause commands later run by root
-# to compromise the system.
-#
-# Revision 1.120  2004/09/02 13:26:29  jalet
-# Small fix for old versions of LPRng
-#
-# Revision 1.119  2004/09/02 13:09:58  jalet
-# Now exports PYKOTAPRINTERHOSTNAME
-#
-# Revision 1.118  2004/08/06 20:46:45  jalet
-# Finished group quota fix for balance when no user in group has a balance
-#
-# Revision 1.117  2004/08/06 13:45:51  jalet
-# Fixed french translation problem.
-# Fixed problem with group quotas and strict enforcement.
-#
-# Revision 1.116  2004/07/24 20:20:29  jalet
-# Unitialized variable
-#
-# Revision 1.115  2004/07/21 09:35:48  jalet
-# Software accounting seems to be OK with LPRng support now
-#
-# Revision 1.114  2004/07/20 22:19:45  jalet
-# Sanitized a bit + use of gettext
-#
-# Revision 1.113  2004/07/17 20:37:27  jalet
-# Missing file... Am I really stupid ?
-#
-# Revision 1.112  2004/07/16 12:22:47  jalet
-# LPRng support early version
-#
-# Revision 1.111  2004/07/06 18:09:42  jalet
-# Reduced the set of invalid characters in names
-#
-# Revision 1.110  2004/07/01 19:56:42  jalet
-# Better dispatching of error messages
-#
-# Revision 1.109  2004/07/01 17:45:49  jalet
-# Added code to handle the description field for printers
-#
-# Revision 1.108  2004/06/24 23:09:30  jalet
-# Also prints read size on last block
-#
-# Revision 1.107  2004/06/23 13:03:28  jalet
-# Catches accounter configuration errors earlier
-#
-# Revision 1.106  2004/06/22 09:31:18  jalet
-# Always send some debug info to CUPS' back channel stream (stderr) as
-# informationnal messages.
-#
-# Revision 1.105  2004/06/21 08:17:38  jalet
-# Added version number in subject message for directive crashrecipient.
-#
-# Revision 1.104  2004/06/18 13:34:49  jalet
-# Now all tracebacks include PyKota's version number
-#
-# Revision 1.103  2004/06/18 13:17:26  jalet
-# Now includes PyKota's version number in messages sent by the crashrecipient
-# directive.
-#
-# Revision 1.102  2004/06/17 13:26:51  jalet
-# Better exception handling code
-#
-# Revision 1.101  2004/06/16 20:56:34  jalet
-# Smarter initialisation code
-#
-# Revision 1.100  2004/06/11 08:16:03  jalet
-# More exceptions catched in case of very early failure.
-#
-# Revision 1.99  2004/06/11 07:07:38  jalet
-# Now detects and logs configuration syntax errors instead of failing without
-# any notice message.
-#
-# Revision 1.98  2004/06/08 19:27:12  jalet
-# Doesn't ignore SIGCHLD anymore
-#
-# Revision 1.97  2004/06/07 22:45:35  jalet
-# Now accepts a job when enforcement is STRICT and predicted account balance
-# is equal to 0.0 : since the job hasn't been printed yet, only its printing
-# will really render balance equal to 0.0, so we should be allowed to print.
-#
-# Revision 1.96  2004/06/05 22:18:04  jalet
-# Now catches some exceptions earlier.
-# storage.py and ldapstorage.py : removed old comments
-#
-# Revision 1.95  2004/06/03 21:50:34  jalet
-# Improved error logging.
-# crashrecipient directive added.
-# Now exports the job's size in bytes too.
-#
-# Revision 1.94  2004/06/03 08:51:03  jalet
-# logs job's size in bytes now
-#
-# Revision 1.93  2004/06/02 21:51:02  jalet
-# Moved the sigterm capturing elsewhere
-#
-# Revision 1.92  2004/06/02 13:21:38  jalet
-# Debug message added
-#
-# Revision 1.91  2004/05/25 05:17:52  jalet
-# Now precomputes the job's size only if current printer's enforcement
-# is "STRICT"
-#
-# Revision 1.90  2004/05/24 22:45:49  jalet
-# New 'enforcement' directive added
-# Polling loop improvements
-#
-# Revision 1.89  2004/05/21 22:02:52  jalet
-# Preliminary work on pre-accounting
-#
-# Revision 1.88  2004/05/18 14:49:20  jalet
-# Big code changes to completely remove the need for "requester" directives,
-# jsut use "hardware(... your previous requester directive's content ...)"
-#
-# Revision 1.87  2004/05/17 19:14:59  jalet
-# Now catches SIGPIPE and SIGCHLD
-#
-# Revision 1.86  2004/05/13 13:59:28  jalet
-# Code simplifications
-#
-# Revision 1.85  2004/05/11 08:26:27  jalet
-# Now catches connection problems to SMTP server
-#
-# Revision 1.84  2004/04/21 08:36:32  jalet
-# Exports the PYKOTASTATUS environment variable when SIGTERM is received.
-#
-# Revision 1.83  2004/04/16 17:03:49  jalet
-# The list of printers groups the current printer is a member of is
-# now exported in the PYKOTAPGROUPS environment variable
-#
-# Revision 1.82  2004/04/13 09:38:03  jalet
-# More work on correct child processes handling
-#
-# Revision 1.81  2004/04/09 22:24:47  jalet
-# Began work on correct handling of child processes when jobs are cancelled by
-# the user. Especially important when an external requester is running for a
-# long time.
-#
-# Revision 1.80  2004/04/06 12:00:21  jalet
-# uninitialized values caused problems
-#
-# Revision 1.79  2004/03/28 21:01:29  jalet
-# PYKOTALIMITBY environment variable is now exported too
-#
-# Revision 1.78  2004/03/08 20:13:25  jalet
-# Allow names to begin with a digit
-#
-# Revision 1.77  2004/03/03 13:10:35  jalet
-# Now catches all smtplib exceptions when there's a problem sending messages
-#
-# Revision 1.76  2004/03/01 14:34:15  jalet
-# PYKOTAPHASE wasn't set at the right time at the end of data transmission
-# to underlying layer (real backend)
-#
-# Revision 1.75  2004/03/01 11:23:25  jalet
-# Pre and Post hooks to external commands are available in the cupspykota
-# backend. Forthe pykota filter they will be implemented real soon now.
-#
-# Revision 1.74  2004/02/26 14:18:07  jalet
-# Should fix the remaining bugs wrt printers groups and users groups.
-#
-# Revision 1.73  2004/02/19 14:20:21  jalet
-# maildomain pykota.conf directive added.
-# Small improvements on mail headers quality.
-#
-# Revision 1.72  2004/01/14 15:51:19  jalet
-# Docstring added.
-#
-# Revision 1.71  2004/01/11 23:22:42  jalet
-# Major code refactoring, it's way cleaner, and now allows automated addition
-# of printers on first print.
-#
-# Revision 1.70  2004/01/08 14:10:32  jalet
-# Copyright year changed.
-#
-# Revision 1.69  2004/01/05 16:02:18  jalet
-# Dots in user, groups and printer names should be allowed.
-#
-# Revision 1.68  2004/01/02 17:38:40  jalet
-# This time it should be better...
-#
-# Revision 1.67  2004/01/02 17:37:09  jalet
-# I'm completely stupid !!! Better to not talk while coding !
-#
-# Revision 1.66  2004/01/02 17:31:26  jalet
-# Forgot to remove some code
-#
-# Revision 1.65  2003/12/06 08:14:38  jalet
-# Added support for CUPS device uris which contain authentication information.
-#
-# Revision 1.64  2003/11/29 22:03:17  jalet
-# Some code refactoring work. New code is not used at this time.
-#
-# Revision 1.63  2003/11/29 20:06:20  jalet
-# Added 'utolower' configuration option to convert all usernames to
-# lowercase when printing. All database accesses are still and will
-# remain case sensitive though.
-#
-# Revision 1.62  2003/11/25 22:37:22  jalet
-# Small code move
-#
-# Revision 1.61  2003/11/25 22:03:28  jalet
-# No more message on stderr when the translation is not available.
-#
-# Revision 1.60  2003/11/25 21:54:05  jalet
-# updated FAQ
-#
-# Revision 1.59  2003/11/25 13:33:43  jalet
-# Puts 'root' instead of '' when printing from CUPS web interface (which
-# gives an empty username)
-#
-# Revision 1.58  2003/11/21 14:28:45  jalet
-# More complete job history.
-#
-# Revision 1.57  2003/11/19 23:19:38  jalet
-# Code refactoring work.
-# Explicit redirection to /dev/null has to be set in external policy now, just
-# like in external mailto.
-#
-# Revision 1.56  2003/11/19 07:40:20  jalet
-# Missing import statement.
-# Better documentation for mailto: external(...)
-#
-# Revision 1.55  2003/11/18 23:43:12  jalet
-# Mailto can be any external command now, as usual.
-#
-# Revision 1.54  2003/10/24 21:52:46  jalet
-# Now can force language when coming from CGI script.
-#
-# Revision 1.53  2003/10/08 21:41:38  jalet
-# External policies for printers works !
-# We can now auto-add users on first print, and do other useful things if needed.
-#
-# Revision 1.52  2003/10/07 09:07:28  jalet
-# Character encoding added to please latest version of Python
-#
-# Revision 1.51  2003/10/06 14:21:41  jalet
-# Test reversed to not retrieve group members when no messages for them.
-#
-# Revision 1.50  2003/10/02 20:23:18  jalet
-# Storage caching mechanism added.
-#
-# Revision 1.49  2003/07/29 20:55:17  jalet
-# 1.14 is out !
-#
-# Revision 1.48  2003/07/21 23:01:56  jalet
-# Modified some messages aout soft limit
-#
-# Revision 1.47  2003/07/16 21:53:08  jalet
-# Really big modifications wrt new configuration file's location and content.
-#
-# Revision 1.46  2003/07/09 20:17:07  jalet
-# Email field added to PostgreSQL schema
-#
-# Revision 1.45  2003/07/08 19:43:51  jalet
-# Configurable warning messages.
-# Poor man's treshold value added.
-#
-# Revision 1.44  2003/07/07 11:49:24  jalet
-# Lots of small fixes with the help of PyChecker
-#
-# Revision 1.43  2003/07/04 09:06:32  jalet
-# Small bug fix wrt undefined "LimitBy" field.
-#
-# Revision 1.42  2003/06/30 12:46:15  jalet
-# Extracted reporting code.
-#
-# Revision 1.41  2003/06/25 14:10:01  jalet
-# Hey, it may work (edpykota --reset excepted) !
-#
-# Revision 1.40  2003/06/10 16:37:54  jalet
-# Deletion of the second user which is not needed anymore.
-# Added a debug configuration field in /etc/pykota.conf
-# All queries can now be sent to the logger in debug mode, this will
-# greatly help improve performance when time for this will come.
-#
-# Revision 1.39  2003/04/29 18:37:54  jalet
-# Pluggable accounting methods (actually doesn't support external scripts)
-#
-# Revision 1.38  2003/04/24 11:53:48  jalet
-# Default policy for unknown users/groups is to DENY printing instead
-# of the previous default to ALLOW printing. This is to solve an accuracy
-# problem. If you set the policy to ALLOW, jobs printed by in nexistant user
-# (from PyKota's POV) will be charged to the next user who prints on the
-# same printer.
-#
-# Revision 1.37  2003/04/24 08:08:27  jalet
-# Debug message forgotten
-#
-# Revision 1.36  2003/04/24 07:59:40  jalet
-# LPRng support now works !
-#
-# Revision 1.35  2003/04/23 22:13:57  jalet
-# Preliminary support for LPRng added BUT STILL UNTESTED.
-#
-# Revision 1.34  2003/04/17 09:26:21  jalet
-# repykota now reports account balances too.
-#
-# Revision 1.33  2003/04/16 12:35:49  jalet
-# Groups quota work now !
-#
-# Revision 1.32  2003/04/16 08:53:14  jalet
-# Printing can now be limited either by user's account balance or by
-# page quota (the default). Quota report doesn't include account balance
-# yet, though.
-#
-# Revision 1.31  2003/04/15 11:30:57  jalet
-# More work done on money print charging.
-# Minor bugs corrected.
-# All tools now access to the storage as priviledged users, repykota excepted.
-#
-# Revision 1.30  2003/04/10 21:47:20  jalet
-# Job history added. Upgrade script neutralized for now !
-#
-# Revision 1.29  2003/03/29 13:45:27  jalet
-# GPL paragraphs were incorrectly (from memory) copied into the sources.
-# Two README files were added.
-# Upgrade script for PostgreSQL pre 1.01 schema was added.
-#
-# Revision 1.28  2003/03/29 13:08:28  jalet
-# Configuration is now expected to be found in /etc/pykota.conf instead of
-# in /etc/cups/pykota.conf
-# Installation script can move old config files to the new location if needed.
-# Better error handling if configuration file is absent.
-#
-# Revision 1.27  2003/03/15 23:01:28  jalet
-# New mailto option in configuration file added.
-# No time to test this tonight (although it should work).
-#
-# Revision 1.26  2003/03/09 23:58:16  jalet
-# Comment
-#
-# Revision 1.25  2003/03/07 22:56:14  jalet
-# 0.99 is out with some bug fixes.
-#
-# Revision 1.24  2003/02/27 23:48:41  jalet
-# Correctly maps PyKota's log levels to syslog log levels
-#
-# Revision 1.23  2003/02/27 22:55:20  jalet
-# WARN log priority doesn't exist.
-#
-# Revision 1.22  2003/02/27 09:09:20  jalet
-# Added a method to match strings against wildcard patterns
-#
-# Revision 1.21  2003/02/17 23:01:56  jalet
-# Typos
-#
-# Revision 1.20  2003/02/17 22:55:01  jalet
-# More options can now be set per printer or globally :
-#
-#       admin
-#       adminmail
-#       gracedelay
-#       requester
-#
-# the printer option has priority when both are defined.
-#
-# Revision 1.19  2003/02/10 11:28:45  jalet
-# Localization
-#
-# Revision 1.18  2003/02/10 01:02:17  jalet
-# External requester is about to work, but I must sleep
-#
-# Revision 1.17  2003/02/09 13:05:43  jalet
-# Internationalization continues...
-#
-# Revision 1.16  2003/02/09 12:56:53  jalet
-# Internationalization begins...
-#
-# Revision 1.15  2003/02/08 22:09:52  jalet
-# Name check method moved here
-#
-# Revision 1.14  2003/02/07 10:42:45  jalet
-# Indentation problem
-#
-# Revision 1.13  2003/02/07 08:34:16  jalet
-# Test wrt date limit was wrong
-#
-# Revision 1.12  2003/02/06 23:20:02  jalet
-# warnpykota doesn't need any user/group name argument, mimicing the
-# warnquota disk quota tool.
-#
-# Revision 1.11  2003/02/06 22:54:33  jalet
-# warnpykota should be ok
-#
-# Revision 1.10  2003/02/06 15:03:11  jalet
-# added a method to set the limit date
-#
-# Revision 1.9  2003/02/06 10:39:23  jalet
-# Preliminary edpykota work.
-#
-# Revision 1.8  2003/02/06 09:19:02  jalet
-# More robust behavior (hopefully) when the user or printer is not managed
-# correctly by the Quota System : e.g. cupsFilter added in ppd file, but
-# printer and/or user not 'yet?' in storage.
-#
-# Revision 1.7  2003/02/06 00:00:45  jalet
-# Now includes the printer name in email messages
-#
-# Revision 1.6  2003/02/05 23:55:02  jalet
-# Cleaner email messages
-#
-# Revision 1.5  2003/02/05 23:45:09  jalet
-# Better DateTime manipulation wrt grace delay
-#
-# Revision 1.4  2003/02/05 23:26:22  jalet
-# Incorrect handling of grace delay
-#
-# Revision 1.3  2003/02/05 22:16:20  jalet
-# DEVICE_URI is undefined outside of CUPS, i.e. for normal command line tools
-#
-# Revision 1.2  2003/02/05 22:10:29  jalet
-# Typos
-#
-# Revision 1.1  2003/02/05 21:28:17  jalet
-# Initial import into CVS
-#
 #
 #
