Show
Ignore:
Timestamp:
04/08/03 23:10:18 (21 years ago)
Author:
jalet
Message:

Checks --groups option presence instead of --users because --users is the default.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/bin/edpykota

    r886 r890  
    2323# 
    2424# $Log$ 
     25# Revision 1.30  2003/04/08 21:10:18  jalet 
     26# Checks --groups option presence instead of --users because --users is the default. 
     27# 
    2528# Revision 1.29  2003/04/05 09:28:56  jalet 
    2629# Unnecessary message was logged 
     
    256259        for (printer, printerpagecounter) in printernames : 
    257260            if options["prototype"] : 
    258                 if options["users"] : 
     261                if options["groups"] : 
     262                    prototype = self.storage.getGroupPQuota(options["prototype"], printer) 
     263                else :      
     264                    # default is user quota edition 
    259265                    prototype = self.storage.getUserPQuota(options["prototype"], printer) 
    260                 else :      
    261                     prototype = self.storage.getGroupPQuota(options["prototype"], printer) 
    262266                if prototype is None : 
    263267                    self.logger.log_message(_("Prototype %s not found in Quota Storage for printer %s.") % (options["prototype"], printer)) 
     
    278282                allnames = names 
    279283            else :    
    280                 if options["users"] :     
     284                if options["groups"] :     
     285                    allnames = self.storage.getPrinterGroups(printer) 
     286                else :     
    281287                    allnames = self.storage.getPrinterUsers(printer) 
    282                 else :     
    283                     allnames = self.storage.getPrinterGroups(printer) 
    284288            for name in [n for n in allnames if self.matchString(n, names)]: 
    285                 if options["users"] : 
     289                if options["groups"] : 
     290                    quota = self.storage.getGroupPQuota(name, printer) 
     291                else : 
    286292                    quota = self.storage.getUserPQuota(name, printer) 
    287                 else : 
    288                     quota = self.storage.getGroupPQuota(name, printer) 
    289293                if quota is None : 
    290294                    # not found 
     
    294298                        # like /etc/passwd because users may be defined  
    295299                        # only remotely 
    296                         if options["users"] : 
     300                        if options["groups"] : 
     301                            if self.isValidName(name) : 
     302                                self.storage.addGroupPQuota(name, printer) 
     303                                quota = self.storage.getGroupPQuota(name, printer) 
     304                            else :     
     305                                self.logger.log_message(_("Invalid group name %s") % name) 
     306                        else : 
    297307                            if self.isValidName(name) : 
    298308                                self.storage.addUserPQuota(name, printer) 
     
    300310                            else :     
    301311                                self.logger.log_message(_("Invalid user name %s") % name) 
    302                         else : 
    303                             if self.isValidName(name) : 
    304                                 self.storage.addGroupPQuota(name, printer) 
    305                                 quota = self.storage.getGroupPQuota(name, printer) 
    306                             else :     
    307                                 self.logger.log_message(_("Invalid group name %s") % name) 
    308312                if quota is None :      
    309313                    self.logger.log_message(_("Quota not found for object %s on printer %s.") % (name, printer)) 
    310314                else :     
    311                     if options["users"] : 
     315                    if options["groups"] : 
     316                        if options["noquota"] or ((softlimit is not None) and (hardlimit is not None)) : 
     317                            self.storage.setGroupPQuota(name, printer, softlimit, hardlimit) 
     318                        if options["reset"] : 
     319                            self.storage.resetGroupPQuota(name, printer) 
     320                    else : 
    312321                        if options["noquota"] or ((softlimit is not None) and (hardlimit is not None)) : 
    313322                            self.storage.setUserPQuota(name, printer, softlimit, hardlimit) 
    314323                        if options["reset"] : 
    315324                            self.storage.resetUserPQuota(name, printer) 
    316                     else : 
    317                         if options["noquota"] or ((softlimit is not None) and (hardlimit is not None)) : 
    318                             self.storage.setGroupPQuota(name, printer, softlimit, hardlimit) 
    319                         if options["reset"] : 
    320                             self.storage.resetGroupPQuota(name, printer) 
    321325                      
    322326if __name__ == "__main__" :