Index: /pykota/trunk/bin/edpykota
===================================================================
--- /pykota/trunk/bin/edpykota (revision 2054)
+++ /pykota/trunk/bin/edpykota (revision 2073)
@@ -24,4 +24,7 @@
 #
 # $Log$
+# Revision 1.88  2005/02/19 17:47:19  jalet
+# Fixed the --prototype command line option to edpykota
+#
 # Revision 1.87  2005/02/13 22:02:28  jalet
 # Big database structure changes. Upgrade script is now included as well as
@@ -600,7 +603,4 @@
             groupnames = []
             
-        if options["prototype"] :    
-            protoentry = getattr(self.storage, "get%s" % suffix)(options["prototype"])
-            
         rejectunknown = self.config.getRejectUnknown()    
         printeradded = 0
@@ -634,4 +634,14 @@
             printersgroups = self.storage.getMatchingPrinters(options["pgroups"])
             
+        if options["prototype"] :    
+            protoentry = getattr(self.storage, "get%s" % suffix)(options["prototype"])
+            if not protoentry.Exists :
+                raise PyKotaToolError, _("Prototype object %s not found in Quota Storage.") % protoentry.Name
+            else :    
+                limitby = protoentry.LimitBy
+                balancevalue = protoentry.AccountBalance
+                balance = str(balance)
+                overcharge = getattr(protoentry, "OverCharge", None)
+            
         todelete = {}    
         changed = {} # tracks changes made at the user/group level
@@ -645,13 +655,9 @@
                 
             if options["prototype"] :
-                if protoentry.Exists :
-                    protoquota = getattr(self.storage, "get%sPQuota" % suffix)(protoentry, printer)
-                    if not protoquota.Exists :
-                        self.printInfo(_("Prototype %s not found in Quota Storage for printer %s.") % (protoentry.Name, printer.Name))
-                        continue    # skip this printer
-                    else :    
-                        (softlimit, hardlimit) = (protoquota.SoftLimit, protoquota.HardLimit)
-                else :        
-                    self.printInfo(_("Prototype object %s not found in Quota Storage.") % protoentry.Name)
+                protoquota = getattr(self.storage, "get%sPQuota" % suffix)(protoentry, printer)
+                if not protoquota.Exists :
+                    self.printInfo(_("Prototype %s not found in Quota Storage for printer %s.") % (protoentry.Name, printer.Name))
+                else :    
+                    (softlimit, hardlimit) = (protoquota.SoftLimit, protoquota.HardLimit)
                     
             if not options["noquota"] :    
@@ -745,5 +751,5 @@
                         
                     if not options["groups"] :
-                        if options["used"] :
+                        if used :
                             entrypquota.setUsage(used)
                             
@@ -824,5 +830,5 @@
         elif (options["add"] or options["prototype"]) and options["delete"] :    
             raise PyKotaToolError, _("incompatible options, see help.")
-        elif (options["softlimit"] or options["hardlimit"]) and options["prototype"] :    
+        elif (options["reset"] or options["hardreset"] or options["limitby"] or options["used"] or options["balance"] or options["overcharge"] or options["softlimit"] or options["hardlimit"]) and options["prototype"] :
             raise PyKotaToolError, _("incompatible options, see help.")
         elif options["noquota"] and (options["prototype"] or options["hardlimit"] or options["softlimit"]) :
Index: /pykota/trunk/NEWS
===================================================================
--- /pykota/trunk/NEWS (revision 2066)
+++ /pykota/trunk/NEWS (revision 2073)
@@ -22,4 +22,9 @@
 PyKota NEWS :
        
+    - 1.21alpha27 :
+    
+        - epykota's --prototype option now works fine with accounts
+          limited by balance.
+          
     - 1.21alpha26 :
     
Index: /pykota/trunk/TODO
===================================================================
--- /pykota/trunk/TODO (revision 2072)
+++ /pykota/trunk/TODO (revision 2073)
@@ -30,6 +30,4 @@
           
         - Allow soft and hard limits to be increased/decreased.
-        
-        - Better --prototype option in edpykota
         
         - Web enabled pykotme.
Index: /pykota/trunk/pykota/version.py
===================================================================
--- /pykota/trunk/pykota/version.py (revision 2066)
+++ /pykota/trunk/pykota/version.py (revision 2073)
@@ -22,5 +22,5 @@
 #
 
-__version__ = "1.21alpha26_unofficial"
+__version__ = "1.21alpha27_unofficial"
 
 __doc__ = """PyKota : a complete Printing Quota Solution for CUPS and LPRng."""
