Index: /pykota/trunk/bin/autopykota
===================================================================
--- /pykota/trunk/bin/autopykota (revision 1759)
+++ /pykota/trunk/bin/autopykota (revision 1780)
@@ -24,4 +24,8 @@
 #
 # $Log$
+# Revision 1.3  2004/10/06 07:51:07  jalet
+# Now autopykota uses 0.0 as the default value for initial account balance
+# if the --initbalance command line option is not used.
+#
 # Revision 1.2  2004/09/30 11:22:30  jalet
 # Extends the PATH and doesn't use absolute path anymore to launch edpykota.
@@ -50,6 +54,4 @@
   OF AN external policy IN pykota.conf
   
-  THIS TOOL IS STILL EXPERIMENTAL. USE AT YOUR OWN RISK !!!
-  
   autopykota { -i | --initbalance value } 
 
@@ -61,5 +63,5 @@
   -i | --initbalance b Sets the user's account initial balance value to b.
                        If the user already exists, actual balance is left
-                       unmodified.
+                       unmodified. If unset, the default value is 0.
                        
 This program is free software; you can redistribute it and/or modify
@@ -91,4 +93,5 @@
             user = self.storage.getUser(username)
             if user.Exists :
+                self.logdebug("User %s already exits." % username) 
                 printer = self.storage.getPrinter(printername)
                 if printer.Exists :
@@ -98,15 +101,13 @@
                         return 0
                     else :    
-                        self.logdebug("User %s already exists. Creating a quota entry for user %s on printer %s." % (username, username, printername))
+                        self.logdebug("Creating a quota entry for user %s on printer %s." % (username, printername))
                         return os.system('edpykota --add --printer "%s" "%s"' % (printername, username))
                 else :
-                    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))
+                    self.logdebug("Printer %s doesn't exist. Creating printer %s and a quota entry for user %s on printer %s." % (printername, printername, username, printername))
                     return os.system('edpykota --add --printer "%s" "%s"' % (printername, username))
             else :
-                if options["initbalance"] is None :
-                    raise PyKotaToolError, "User %s doesn't exist yet, but no initial balance value is given. Fatal Error." % username
-                else :
-                    self.logdebug("User %s doesn't exist yet. Creating user %s's account and quota entries on all existing printers." % (username, username))
-                    return os.system('edpykota --add --limitby balance --balance "%s" "%s"' % (options["initbalance"], username))
+                self.logdebug("User %s doesn't exist yet." % username)
+                self.logdebug("Creating user %s's account with balance %.2f and quota entries on all existing printers." % (username, options["initbalance"]))
+                return os.system('edpykota --add --limitby balance --balance "%s" "%s"' % (options["initbalance"], username))
     
 if __name__ == "__main__" :    
@@ -114,4 +115,5 @@
     try :
         defaults = { \
+                     "initbalance" : 0.0
                    }
         short_options = "vhi:"
@@ -127,5 +129,5 @@
         options["help"] = options["h"] or options["help"]
         options["version"] = options["v"] or options["version"]
-        options["initbalance"] = options["i"] or options["initbalance"] 
+        options["initbalance"] = options["i"] or options["initbalance"] or defaults["initbalance"]
         
         if options["help"] :
Index: /pykota/trunk/man/autopykota.1
===================================================================
--- /pykota/trunk/man/autopykota.1 (revision 1758)
+++ /pykota/trunk/man/autopykota.1 (revision 1780)
@@ -1,8 +1,8 @@
 .\" DO NOT MODIFY THIS FILE!  It was generated by help2man 1.33.
-.TH AUTOPYKOTA "1" "September 2004" "C@LL - Conseil Internet & Logiciels Libres" "User Commands"
+.TH AUTOPYKOTA "1" "October 2004" "C@LL - Conseil Internet & Logiciels Libres" "User Commands"
 .SH NAME
-autopykota \- manual page for autopykota 1.20alpha18_unofficial
+autopykota \- manual page for autopykota 1.20alpha20_unofficial
 .SH DESCRIPTION
-autopykota v1.20alpha18_unofficial (c) 2003-2004 C@LL - Conseil Internet & Logiciels Libres
+autopykota v1.20alpha20_unofficial (c) 2003-2004 C@LL - Conseil Internet & Logiciels Libres
 A tool to automate user account creation and initial balance setting.
 .PP
@@ -13,6 +13,4 @@
 THIS TOOL MUST NOT BE USED FROM THE COMMAND LINE BUT ONLY AS PART
 OF AN external policy IN pykota.conf
-.IP
-THIS TOOL IS STILL EXPERIMENTAL. USE AT YOUR OWN RISK !!!
 .IP
 autopykota { \fB\-i\fR | \fB\-\-initbalance\fR value }
@@ -28,5 +26,5 @@
 \fB\-i\fR | \fB\-\-initbalance\fR b Sets the user's account initial balance value to b.
 If the user already exists, actual balance is left
-unmodified.
+unmodified. If unset, the default value is 0.
 .PP
 This program is free software; you can redistribute it and/or modify
