Changeset 1780 for pykota/trunk
- Timestamp:
- 10/06/04 09:51:07 (20 years ago)
- Location:
- pykota/trunk
- Files:
-
- 2 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/bin/autopykota
r1759 r1780 24 24 # 25 25 # $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 # 26 30 # Revision 1.2 2004/09/30 11:22:30 jalet 27 31 # Extends the PATH and doesn't use absolute path anymore to launch edpykota. … … 50 54 OF AN external policy IN pykota.conf 51 55 52 THIS TOOL IS STILL EXPERIMENTAL. USE AT YOUR OWN RISK !!!53 54 56 autopykota { -i | --initbalance value } 55 57 … … 61 63 -i | --initbalance b Sets the user's account initial balance value to b. 62 64 If the user already exists, actual balance is left 63 unmodified. 65 unmodified. If unset, the default value is 0. 64 66 65 67 This program is free software; you can redistribute it and/or modify … … 91 93 user = self.storage.getUser(username) 92 94 if user.Exists : 95 self.logdebug("User %s already exits." % username) 93 96 printer = self.storage.getPrinter(printername) 94 97 if printer.Exists : … … 98 101 return 0 99 102 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)) 101 104 return os.system('edpykota --add --printer "%s" "%s"' % (printername, username)) 102 105 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)) 104 107 return os.system('edpykota --add --printer "%s" "%s"' % (printername, username)) 105 108 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)) 111 112 112 113 if __name__ == "__main__" : … … 114 115 try : 115 116 defaults = { \ 117 "initbalance" : 0.0 116 118 } 117 119 short_options = "vhi:" … … 127 129 options["help"] = options["h"] or options["help"] 128 130 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"] 130 132 131 133 if options["help"] : -
pykota/trunk/man/autopykota.1
r1758 r1780 1 1 .\" 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" 3 3 .SH NAME 4 autopykota \- manual page for autopykota 1.20alpha 18_unofficial4 autopykota \- manual page for autopykota 1.20alpha20_unofficial 5 5 .SH DESCRIPTION 6 autopykota v1.20alpha 18_unofficial (c) 2003-2004 C@LL - Conseil Internet & Logiciels Libres6 autopykota v1.20alpha20_unofficial (c) 2003-2004 C@LL - Conseil Internet & Logiciels Libres 7 7 A tool to automate user account creation and initial balance setting. 8 8 .PP … … 13 13 THIS TOOL MUST NOT BE USED FROM THE COMMAND LINE BUT ONLY AS PART 14 14 OF AN external policy IN pykota.conf 15 .IP16 THIS TOOL IS STILL EXPERIMENTAL. USE AT YOUR OWN RISK !!!17 15 .IP 18 16 autopykota { \fB\-i\fR | \fB\-\-initbalance\fR value } … … 28 26 \fB\-i\fR | \fB\-\-initbalance\fR b Sets the user's account initial balance value to b. 29 27 If the user already exists, actual balance is left 30 unmodified. 28 unmodified. If unset, the default value is 0. 31 29 .PP 32 30 This program is free software; you can redistribute it and/or modify