Index: /pykota/trunk/bin/edpykota
===================================================================
--- /pykota/trunk/bin/edpykota (revision 923)
+++ /pykota/trunk/bin/edpykota (revision 924)
@@ -23,4 +23,8 @@
 #
 # $Log$
+# Revision 1.40  2003/04/16 08:22:09  jalet
+# More strict error detection.
+# Minor code rewrite to avoid some repetitive tests.
+#
 # Revision 1.39  2003/04/16 08:01:53  jalet
 # edpykota --charge command line option works now.
@@ -317,4 +321,5 @@
             else :
                 raise PyKotaToolError, _("There's no printer matching %s") % pname
+                
         softlimit = hardlimit = None    
         if options["softlimit"] :
@@ -332,4 +337,5 @@
             self.logger.log_message(_("Hard limit %i is less than soft limit %i, values will be exchanged.") % (hardlimit, softlimit))
             (softlimit, hardlimit) = (hardlimit, softlimit)
+            
         if not names :    
             if options["add"] and not printeradded :
@@ -337,4 +343,13 @@
             else :    
                 names = [ "*" ] # all users
+                
+        balance = options["balance"]
+        if balance :
+            balance = balance.strip()
+            try :
+                balancevalue = float(balance)
+            except ValueError :    
+                raise PyKotaToolError, _("Invalid balance value %s" % options["balance"])
+            
         if options["charge"] :
             try :
@@ -345,4 +360,11 @@
                 if len(charges) < 2 :
                     charges.append(None)
+                    
+        limitby = options["limitby"]
+        if limitby :
+            limitby = limitby.strip().lower()
+        if limitby and (limitby not in ('quota', 'balance')) :    
+            raise PyKotaToolError, _("Invalid limitby value %s" % options["limitby"])
+            
         for (printerid, printer) in printers :
             if options["charge"] :
@@ -416,9 +438,4 @@
                             self.storage.deleteUser(ident)
                     else :
-                        limitby = options["limitby"]
-                        if limitby :
-                            limitby = limitby.lower()
-                        if limitby and (limitby not in ('quota', 'balance')) :    
-                            limitby = 'quota'
                         if options["groups"] :
                             if options["noquota"] or options["prototype"] or ((softlimit is not None) and (hardlimit is not None)) :
@@ -436,16 +453,9 @@
                             if limitby :
                                 self.storage.limitUserBy(ident, limitby)
-                            balance = options["balance"]    
                             if balance :
-                                balance = balance.strip()
-                                try :
-                                    balancevalue = float(balance)
-                                except ValueError :    
-                                    pass # TODO : log something when incorrect balance value
-                                else :    
-                                    if balance.startswith("+") or balance.startswith("-") :
-                                        self.storage.increaseUserBalance(ident, balancevalue)
-                                    else :
-                                        self.storage.setUserBalance(ident, balancevalue)
+                                if balance.startswith("+") or balance.startswith("-") :
+                                    self.storage.increaseUserBalance(ident, balancevalue)
+                                else :
+                                    self.storage.setUserBalance(ident, balancevalue)
                             self.warnUserPQuota(name, printer)    
                      
Index: /pykota/trunk/po/en/pykota.po
===================================================================
--- /pykota/trunk/po/en/pykota.po (revision 923)
+++ /pykota/trunk/po/en/pykota.po (revision 924)
@@ -21,4 +21,8 @@
 #
 # $Log$
+# Revision 1.16  2003/04/16 08:22:09  jalet
+# More strict error detection.
+# Minor code rewrite to avoid some repetitive tests.
+#
 # Revision 1.15  2003/04/16 08:01:54  jalet
 # edpykota --charge command line option works now.
@@ -261,2 +265,8 @@
 msgid "Invalid charge amount value %s"
 msgstr ""
+
+msgid "Invalid balance value %s"
+msgstr ""
+
+msgid "Invalid limitby value %s"
+msgstr ""
Index: /pykota/trunk/po/fr/pykota.po
===================================================================
--- /pykota/trunk/po/fr/pykota.po (revision 923)
+++ /pykota/trunk/po/fr/pykota.po (revision 924)
@@ -21,4 +21,8 @@
 #
 # $Log$
+# Revision 1.14  2003/04/16 08:22:10  jalet
+# More strict error detection.
+# Minor code rewrite to avoid some repetitive tests.
+#
 # Revision 1.13  2003/04/16 08:01:54  jalet
 # edpykota --charge command line option works now.
@@ -268,3 +272,9 @@
 
 msgid "Invalid charge amount value %s"
-msgstr "Montant �omptabiliser %s incorrect"
+msgstr "Montant �omptabiliser %s invalide"
+
+msgid "Invalid balance value %s"
+msgstr "Valeur %s du solde invalide"
+
+msgid "Invalid limitby value %s"
+msgstr "Valeur de l'option limitby %s invalide"
Index: /pykota/trunk/po/pykota.pot
===================================================================
--- /pykota/trunk/po/pykota.pot (revision 923)
+++ /pykota/trunk/po/pykota.pot (revision 924)
@@ -21,4 +21,8 @@
 #
 # $Log$
+# Revision 1.16  2003/04/16 08:22:09  jalet
+# More strict error detection.
+# Minor code rewrite to avoid some repetitive tests.
+#
 # Revision 1.15  2003/04/16 08:01:54  jalet
 # edpykota --charge command line option works now.
@@ -261,2 +265,8 @@
 msgid "Invalid charge amount value %s"
 msgstr ""
+
+msgid "Invalid balance value %s"
+msgstr ""
+
+msgid "Invalid limitby value %s"
+msgstr ""
