Show
Ignore:
Timestamp:
01/08/04 17:24:49 (20 years ago)
Author:
jalet
Message:

edpykota now supports adding printers to printer groups.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/bin/edpykota

    r1257 r1258  
    2424# 
    2525# $Log$ 
     26# Revision 1.65  2004/01/08 16:24:49  jalet 
     27# edpykota now supports adding printers to printer groups. 
     28# 
    2629# Revision 1.64  2004/01/08 14:10:32  jalet 
    2730# Copyright year changed. 
     
    276279                       by separating them with commas. 
    277280   
    278   -g | --groups        Edit groups print quotas instead of users. 
     281  -G | --pgroups pg1[,pg2...] Adds the printer(s) to the printer groups 
     282                       pg1, pg2, etc... which must already exist. 
     283                       A printer group is just like a normal printer, 
     284                       only that it is usually unknown from the printing 
     285                       system. Create printer groups exactly the same 
     286                       way that you create printers, then add other  
     287                       printers to them with this option. 
     288                       Accounting is done on a printer and on all 
     289                       the printer groups it belongs to, quota checking 
     290                       is done on a printer and on all the printer groups 
     291                       it belongs to. 
     292   
     293  -g | --groups        Edit users groups print quotas instead of users. 
    279294                           
    280295  -p | --prototype u|g Uses user u or group g as a prototype to set 
     
    366381  This will set the page price for printer lp to 0.1. Job price 
    367382  will not be changed. 
     383   
     384  $ edpykota --printer hplj1,hplj2 --pgroups Laser,HP 
     385   
     386  This will put printers hplj1 and hplj2 in printers groups Laser and HP. 
     387  When printing either on hplj1 or hplj2, print quota will also be  
     388  checked and accounted for on virtual printers Laser and HP. 
    368389 
    369390This program is free software; you can redistribute it and/or modify 
     
    464485                names = [ "*" ] # all users 
    465486                 
     487        printersgroups = []         
     488        if options["pgroups"] :         
     489            printersgroups = self.storage.getMatchingPrinters(options["pgroups"]) 
     490             
    466491        changed = {} # tracks changes made at the user/group level 
    467492        for printer in printers : 
     493            for pgroup in printersgroups : 
     494                pgroup.addPrinterToGroup(printer)     
     495                 
    468496            if options["charge"] : 
    469497                (perpage, perjob) = charges 
     
    576604                     "printer" : "*", \ 
    577605                   } 
    578         short_options = "vhdc:l:b:i:naugrp:P:S:H:" 
    579         long_options = ["help", "version", "charge=", "delete", "limitby=", "balance=", "ingroups=", "noquota", "add", "users", "groups", "reset", "prototype=", "printer=", "softlimit=", "hardlimit="] 
     606        short_options = "vhdc:l:b:i:naugrp:P:S:H:G:" 
     607        long_options = ["help", "version", "charge=", "delete", "limitby=", "balance=", "ingroups=", "noquota", "add", "users", "groups", "reset", "prototype=", "printer=", "softlimit=", "hardlimit=", "pgroups="] 
    580608         
    581609        # Initializes the command line tool 
     
    602630        options["ingroups"] = options["i"] or options["ingroups"] 
    603631        options["charge"] = options["c"] or options["charge"] 
     632        options["pgroups"] = options["G"] or options["pgroups"] 
    604633         
    605634        if options["help"] :