Changeset 815 for pykota/trunk

Show
Ignore:
Timestamp:
02/27/03 10:04:46 (22 years ago)
Author:
jalet
Message:

user and group names can be passed as wildcards if the --add option
is not set. The default is to act on all users or groups.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/bin/edpykota

    r791 r815  
    1717# 
    1818# $Log$ 
     19# Revision 1.21  2003/02/27 09:04:46  jalet 
     20# user and group names can be passed as wildcards if the --add option 
     21# is not set. The default is to act on all users or groups. 
     22# 
    1923# Revision 1.20  2003/02/10 12:07:30  jalet 
    2024# Now repykota should output the recorded total page number for each printer too. 
     
    123127  -H | --hardlimit hl  Sets the quota hard limit to hl pages. 
    124128   
     129  user1 through userN and group1 through groupN can use wildcards 
     130  if the --add option is not set. 
     131   
    125132examples :                               
    126133 
     
    149156  to 550 pages for groups financial and support on all printers. 
    150157   
    151   $ edpykota --reset jerome  
    152    
    153   This will reset jerome's page counter to zero on all printers.  
    154   His life time page counter on each printer will be kept unchanged. 
     158  $ edpykota --reset jerome "jo*" 
     159   
     160  This will reset jerome's page counter to zero on all printers, as 
     161  well as every user whose name begins with 'jo'. 
     162  Their life time page counter on each printer will be kept unchanged. 
    155163 
    156164This program is free software; you can redistribute it and/or modify 
     
    200208            self.logger.log_message(_("Hard limit %i is less than soft limit %i, values will be exchanged.") % (hardlimit, softlimit), "warn") 
    201209            (softlimit, hardlimit) = (hardlimit, softlimit) 
     210        if not names :     
     211            if options["add"] : 
     212                raise PyKotaToolError, _("You have to pass user names on the command line") 
     213            else :     
     214                names = [ "*" ] # all users 
    202215        for (printer, printerpagecounter) in printernames : 
    203216            if options["prototype"] : 
     
    219232            if (not options["reset"]) and ((hardlimit is None) or (softlimit is None)) :         
    220233                raise PyKotaToolError, _("Both hard and soft limits must be set ! Aborting.") 
    221             for name in names : 
     234            if options["users"] :     
     235                allnames = self.storage.getPrinterUsers(printer) 
     236            else :     
     237                allnames = self.storage.getPrinterGroups(printer) 
     238            for name in [n for n in allnames if self.matchString(n, names)]: 
    222239                if options["users"] : 
    223240                    quota = self.storage.getUserPQuota(name, printer)