Changeset 2073 for pykota/trunk

Show
Ignore:
Timestamp:
02/19/05 18:47:19 (20 years ago)
Author:
jalet
Message:

Fixed the --prototype command line option to edpykota

Location:
pykota/trunk
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/bin/edpykota

    r2054 r2073  
    2424# 
    2525# $Log$ 
     26# Revision 1.88  2005/02/19 17:47:19  jalet 
     27# Fixed the --prototype command line option to edpykota 
     28# 
    2629# Revision 1.87  2005/02/13 22:02:28  jalet 
    2730# Big database structure changes. Upgrade script is now included as well as 
     
    600603            groupnames = [] 
    601604             
    602         if options["prototype"] :     
    603             protoentry = getattr(self.storage, "get%s" % suffix)(options["prototype"]) 
    604              
    605605        rejectunknown = self.config.getRejectUnknown()     
    606606        printeradded = 0 
     
    634634            printersgroups = self.storage.getMatchingPrinters(options["pgroups"]) 
    635635             
     636        if options["prototype"] :     
     637            protoentry = getattr(self.storage, "get%s" % suffix)(options["prototype"]) 
     638            if not protoentry.Exists : 
     639                raise PyKotaToolError, _("Prototype object %s not found in Quota Storage.") % protoentry.Name 
     640            else :     
     641                limitby = protoentry.LimitBy 
     642                balancevalue = protoentry.AccountBalance 
     643                balance = str(balance) 
     644                overcharge = getattr(protoentry, "OverCharge", None) 
     645             
    636646        todelete = {}     
    637647        changed = {} # tracks changes made at the user/group level 
     
    645655                 
    646656            if options["prototype"] : 
    647                 if protoentry.Exists : 
    648                     protoquota = getattr(self.storage, "get%sPQuota" % suffix)(protoentry, printer) 
    649                     if not protoquota.Exists : 
    650                         self.printInfo(_("Prototype %s not found in Quota Storage for printer %s.") % (protoentry.Name, printer.Name)) 
    651                         continue    # skip this printer 
    652                     else :     
    653                         (softlimit, hardlimit) = (protoquota.SoftLimit, protoquota.HardLimit) 
    654                 else :         
    655                     self.printInfo(_("Prototype object %s not found in Quota Storage.") % protoentry.Name) 
     657                protoquota = getattr(self.storage, "get%sPQuota" % suffix)(protoentry, printer) 
     658                if not protoquota.Exists : 
     659                    self.printInfo(_("Prototype %s not found in Quota Storage for printer %s.") % (protoentry.Name, printer.Name)) 
     660                else :     
     661                    (softlimit, hardlimit) = (protoquota.SoftLimit, protoquota.HardLimit) 
    656662                     
    657663            if not options["noquota"] :     
     
    745751                         
    746752                    if not options["groups"] : 
    747                         if options["used"] : 
     753                        if used : 
    748754                            entrypquota.setUsage(used) 
    749755                             
     
    824830        elif (options["add"] or options["prototype"]) and options["delete"] :     
    825831            raise PyKotaToolError, _("incompatible options, see help.") 
    826         elif (options["softlimit"] or options["hardlimit"]) and options["prototype"] :     
     832        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"] : 
    827833            raise PyKotaToolError, _("incompatible options, see help.") 
    828834        elif options["noquota"] and (options["prototype"] or options["hardlimit"] or options["softlimit"]) : 
  • pykota/trunk/NEWS

    r2066 r2073  
    2222PyKota NEWS : 
    2323        
     24    - 1.21alpha27 : 
     25     
     26        - epykota's --prototype option now works fine with accounts 
     27          limited by balance. 
     28           
    2429    - 1.21alpha26 : 
    2530     
  • pykota/trunk/pykota/version.py

    r2066 r2073  
    2222# 
    2323 
    24 __version__ = "1.21alpha26_unofficial" 
     24__version__ = "1.21alpha27_unofficial" 
    2525 
    2626__doc__ = """PyKota : a complete Printing Quota Solution for CUPS and LPRng.""" 
  • pykota/trunk/TODO

    r2072 r2073  
    3030           
    3131        - Allow soft and hard limits to be increased/decreased. 
    32          
    33         - Better --prototype option in edpykota 
    3432         
    3533        - Web enabled pykotme.