Changeset 1780 for pykota/trunk

Show
Ignore:
Timestamp:
10/06/04 09:51:07 (20 years ago)
Author:
jalet
Message:

Now autopykota uses 0.0 as the default value for initial account balance
if the --initbalance command line option is not used.

Location:
pykota/trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/bin/autopykota

    r1759 r1780  
    2424# 
    2525# $Log$ 
     26# Revision 1.3  2004/10/06 07:51:07  jalet 
     27# Now autopykota uses 0.0 as the default value for initial account balance 
     28# if the --initbalance command line option is not used. 
     29# 
    2630# Revision 1.2  2004/09/30 11:22:30  jalet 
    2731# Extends the PATH and doesn't use absolute path anymore to launch edpykota. 
     
    5054  OF AN external policy IN pykota.conf 
    5155   
    52   THIS TOOL IS STILL EXPERIMENTAL. USE AT YOUR OWN RISK !!! 
    53    
    5456  autopykota { -i | --initbalance value }  
    5557 
     
    6163  -i | --initbalance b Sets the user's account initial balance value to b. 
    6264                       If the user already exists, actual balance is left 
    63                        unmodified. 
     65                       unmodified. If unset, the default value is 0. 
    6466                        
    6567This program is free software; you can redistribute it and/or modify 
     
    9193            user = self.storage.getUser(username) 
    9294            if user.Exists : 
     95                self.logdebug("User %s already exits." % username)  
    9396                printer = self.storage.getPrinter(printername) 
    9497                if printer.Exists : 
     
    98101                        return 0 
    99102                    else :     
    100                         self.logdebug("User %s already exists. Creating a quota entry for user %s on printer %s." % (username, username, printername)) 
     103                        self.logdebug("Creating a quota entry for user %s on printer %s." % (username, printername)) 
    101104                        return os.system('edpykota --add --printer "%s" "%s"' % (printername, username)) 
    102105                else : 
    103                     self.logdebug("User %s already exists. Printer %s doesn't exist. Creating printer %s and a quota entry for user %s on printer %s." % (username, printername, printername, username, printername)) 
     106                    self.logdebug("Printer %s doesn't exist. Creating printer %s and a quota entry for user %s on printer %s." % (printername, printername, username, printername)) 
    104107                    return os.system('edpykota --add --printer "%s" "%s"' % (printername, username)) 
    105108            else : 
    106                 if options["initbalance"] is None : 
    107                     raise PyKotaToolError, "User %s doesn't exist yet, but no initial balance value is given. Fatal Error." % username 
    108                 else : 
    109                     self.logdebug("User %s doesn't exist yet. Creating user %s's account and quota entries on all existing printers." % (username, username)) 
    110                     return os.system('edpykota --add --limitby balance --balance "%s" "%s"' % (options["initbalance"], username)) 
     109                self.logdebug("User %s doesn't exist yet." % username) 
     110                self.logdebug("Creating user %s's account with balance %.2f and quota entries on all existing printers." % (username, options["initbalance"])) 
     111                return os.system('edpykota --add --limitby balance --balance "%s" "%s"' % (options["initbalance"], username)) 
    111112     
    112113if __name__ == "__main__" :     
     
    114115    try : 
    115116        defaults = { \ 
     117                     "initbalance" : 0.0 
    116118                   } 
    117119        short_options = "vhi:" 
     
    127129        options["help"] = options["h"] or options["help"] 
    128130        options["version"] = options["v"] or options["version"] 
    129         options["initbalance"] = options["i"] or options["initbalance"]  
     131        options["initbalance"] = options["i"] or options["initbalance"] or defaults["initbalance"] 
    130132         
    131133        if options["help"] : 
  • pykota/trunk/man/autopykota.1

    r1758 r1780  
    11.\" DO NOT MODIFY THIS FILE!  It was generated by help2man 1.33. 
    2 .TH AUTOPYKOTA "1" "September 2004" "C@LL - Conseil Internet & Logiciels Libres" "User Commands" 
     2.TH AUTOPYKOTA "1" "October 2004" "C@LL - Conseil Internet & Logiciels Libres" "User Commands" 
    33.SH NAME 
    4 autopykota \- manual page for autopykota 1.20alpha18_unofficial 
     4autopykota \- manual page for autopykota 1.20alpha20_unofficial 
    55.SH DESCRIPTION 
    6 autopykota v1.20alpha18_unofficial (c) 2003-2004 C@LL - Conseil Internet & Logiciels Libres 
     6autopykota v1.20alpha20_unofficial (c) 2003-2004 C@LL - Conseil Internet & Logiciels Libres 
    77A tool to automate user account creation and initial balance setting. 
    88.PP 
     
    1313THIS TOOL MUST NOT BE USED FROM THE COMMAND LINE BUT ONLY AS PART 
    1414OF AN external policy IN pykota.conf 
    15 .IP 
    16 THIS TOOL IS STILL EXPERIMENTAL. USE AT YOUR OWN RISK !!! 
    1715.IP 
    1816autopykota { \fB\-i\fR | \fB\-\-initbalance\fR value } 
     
    2826\fB\-i\fR | \fB\-\-initbalance\fR b Sets the user's account initial balance value to b. 
    2927If the user already exists, actual balance is left 
    30 unmodified. 
     28unmodified. If unset, the default value is 0. 
    3129.PP 
    3230This program is free software; you can redistribute it and/or modify