Changeset 927 for pykota/trunk/bin

Show
Ignore:
Timestamp:
04/16/03 14:35:49 (21 years ago)
Author:
jalet
Message:

Groups quota work now !

Location:
pykota/trunk/bin
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/bin/edpykota

    r924 r927  
    2323# 
    2424# $Log$ 
     25# Revision 1.41  2003/04/16 12:35:49  jalet 
     26# Groups quota work now ! 
     27# 
    2528# Revision 1.40  2003/04/16 08:22:09  jalet 
    2629# More strict error detection. 
     
    340343        if not names :     
    341344            if options["add"] and not printeradded : 
    342                 raise PyKotaToolError, _("You have to pass user names on the command line") 
     345                raise PyKotaToolError, _("You have to pass user or group names on the command line") 
    343346            else :     
    344347                names = [ "*" ] # all users 
     
    366369        if limitby and (limitby not in ('quota', 'balance')) :     
    367370            raise PyKotaToolError, _("Invalid limitby value %s" % options["limitby"]) 
     371             
     372        if options["ingroups"] :     
     373            groupnames = [gname.strip() for gname in options["ingroups"].split(',')] 
     374        else :     
     375            groupnames = [] 
    368376             
    369377        for (printerid, printer) in printers : 
     
    393401                if softlimit is not None : 
    394402                    self.logger.log_message(_("Undefined soft limit set to hard limit (%s) on printer %s.") % (str(softlimit), printer)) 
    395             if (not options["reset"] and not options["noquota"] and not options["prototype"] and not options["limitby"] and not options["balance"] and not options["delete"] and not options["charge"]) and ((hardlimit is None) or (softlimit is None)) : 
     403            if (not options["ingroups"] and not options["reset"] and not options["noquota"] and not options["prototype"] and not options["limitby"] and not options["balance"] and not options["delete"] and not options["charge"]) and ((hardlimit is None) or (softlimit is None)) : 
    396404                raise PyKotaToolError, _("Both hard and soft limits must be set ! Aborting.") 
    397405            if options["add"] :     
     
    458466                                else : 
    459467                                    self.storage.setUserBalance(ident, balancevalue) 
     468                            for groupname in groupnames :         
     469                                groupid = self.storage.getGroupId(groupname) 
     470                                if groupid is not None : 
     471                                    self.storage.addUserToGroup(ident, groupid) 
    460472                            self.warnUserPQuota(name, printer)     
    461473                      
     
    506518        elif options["groups"] and (options["balance"] or options["ingroups"]) : 
    507519            raise PyKotaToolError, _("incompatible options, see help.") 
    508         elif options["groups"] :     
    509             raise PyKotaToolError, _("option --groups is currently not implemented.") 
    510520        else : 
    511521            sys.exit(editor.main(args, options)) 
  • pykota/trunk/bin/repykota

    r915 r927  
    2323# 
    2424# $Log$ 
     25# Revision 1.26  2003/04/16 12:35:49  jalet 
     26# Groups quota work now ! 
     27# 
    2528# Revision 1.25  2003/04/15 11:30:57  jalet 
    2629# More work done on money print charging. 
     
    177180                print _("Group            used     soft     hard   grace        total") 
    178181                print "------------------------------------------------------------" 
    179                 for name in self.storage.getPrinterGroups(printerid) : 
     182                for (ident, name) in self.storage.getPrinterGroups(printerid) : 
    180183                    quota = self.storage.getGroupPQuota(ident, printerid)  
    181184                    total += self.printQuota(name, quota) 
     
    200203        """Prints the quota information.""" 
    201204        if quota is not None : 
    202             lifepagecounter = quota["lifepagecounter"] 
    203             pagecounter = quota["pagecounter"] 
     205            lifepagecounter = quota["lifepagecounter"] or 0 
     206            pagecounter = quota["pagecounter"] or 0 
    204207            softlimit = quota["softlimit"] 
    205208            hardlimit = quota["hardlimit"] 
     
    244247        elif options["users"] and options["groups"] :     
    245248            raise PyKotaToolError, _("incompatible options, see help.") 
    246         elif options["groups"] :     
    247             raise PyKotaToolError, _("option --groups is currently not implemented.") 
    248249        elif args :     
    249250            raise PyKotaToolError, _("unused arguments [%s]. Aborting.") % ", ".join(args) 
  • pykota/trunk/bin/warnpykota

    r900 r927  
    2323# 
    2424# $Log$ 
     25# Revision 1.16  2003/04/16 12:35:49  jalet 
     26# Groups quota work now ! 
     27# 
    2528# Revision 1.15  2003/04/10 21:47:20  jalet 
    2629# Job history added. Upgrade script neutralized for now ! 
     
    175178        elif options["users"] and options["groups"] :     
    176179            raise PyKotaToolError, _("incompatible options, see help.") 
    177         elif options["groups"] :     
    178             raise PyKotaToolError, _("option --groups is currently not implemented.") 
    179180        elif args :     
    180181            raise PyKotaToolError, _("unused arguments [%s]. Aborting.") % ", ".join(args)