Changeset 2466 for pykota

Show
Ignore:
Timestamp:
09/19/05 19:26:41 (19 years ago)
Author:
jerome
Message:

Much more powerful pkturnkey

Location:
pykota/trunk
Files:
15 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/bin/pkturnkey

    r2435 r2466  
    4141command line usage : 
    4242 
    43   pkturnkey [options] 
     43  pkturnkey [options] [printqueues names] 
    4444 
    4545options : 
     
    9292  To REALLY initialize the database instead of simulating it, please 
    9393  use the -f | --force command line switch. 
     94   
     95  You can limit the initialization to only a subset of the existing 
     96  printers, by passing their names at the end of the command line. 
    9497""") 
    9598         
    9699class PKTurnKey(Tool) : 
    97100    """A class for an initialization tool.""" 
    98     def listPrinters(self) : 
     101    def listPrinters(self, namestomatch) : 
    99102        """Returns a list of tuples (queuename, deviceuri) for all existing print queues.""" 
    100103        self.printInfo("Extracting all print queues.") 
     
    107110            deviceuri = end.strip() 
    108111            queuename = begin.split()[-1] 
    109             printers.append((queuename, deviceuri)) 
     112            if self.matchString(queuename, namestomatch) : 
     113                printers.append((queuename, deviceuri)) 
     114            else :     
     115                self.printInfo("Print queue %s skipped." % queuename) 
    110116        return printers     
    111117         
     
    160166                self.printInfo(_("Printer %s is not managed by PyKota yet. Please modify printers.conf and restart CUPS.") % p, "warn") 
    161167         
    162     def createUsers(self, users, dryrun=0) : 
     168    def createUsers(self, users, printers, dryrun=0) : 
    163169        """Creates all users in PyKota's database.""" 
    164170        if users : 
    165             command = "edpykota --add --noquota %s" % " ".join(['"%s"' % u for u in users]) 
     171            printersnames = [p[0] for p in printers] 
     172            command = "edpykota --add --noquota --printer %s %s" % (",".join(['"%s"' % p for p in printersnames]), \ 
     173                                                                    " ".join(['"%s"' % u for u in users])) 
    166174            self.runCommand(command, dryrun) 
    167175             
    168     def createGroups(self, groups, dryrun=0) : 
     176    def createGroups(self, groups, printers, dryrun=0) : 
    169177        """Creates all groups in PyKota's database.""" 
    170178        if groups : 
    171             commands = ["edpykota --groups --add --noquota %s" % " ".join(['"%s"' % g for g in groups.keys()])] 
     179            printersnames = [p[0] for p in printers] 
     180            commands = ["edpykota --add --groups --noquota --printer %s %s" % (",".join(['"%s"' % p for p in printersnames]), \ 
     181                                                                               " ".join(['"%s"' % g for g in groups.keys()]))] 
    172182            revmembership = {} 
    173183            for (groupname, usernames) in groups.items() : 
     
    184194            raise PyKotaToolError, "%s : %s" % (pwd.getpwuid(os.geteuid())[0], _("You're not allowed to use this command.")) 
    185195             
    186         # TODO : names not used for now     
    187196        if not names : 
    188197            names = ["*"] 
     
    259268            groups = [] 
    260269             
    261         printers = self.listPrinters()                     
     270        printers = self.listPrinters(names) 
    262271        if printers : 
    263272            self.createPrinters(printers, dryrun) 
    264             self.createUsers([entry[0] for entry in users], dryrun) 
    265             self.createGroups(groups, dryrun) 
     273            self.createUsers([entry[0] for entry in users], printers, dryrun) 
     274            self.createGroups(groups, printers, dryrun) 
    266275         
    267276        if dryrun : 
  • pykota/trunk/man/de/pkturnkey.1

    r2453 r2466  
    22.TH PKTURNKEY "1" "septembre 2005" "C@LL - Conseil Internet & Logiciels Libres" "User Commands" 
    33.SH NOM 
    4 pkturnkey \- page de manuel de pkturnkey 1.23alpha30_unofficial 
     4pkturnkey \- page de manuel de pkturnkey 1.23alpha31_unofficial 
    55.SH DESCRIPTION 
    6 pkturnkey v1.23alpha30_unofficial (c) 2003, 2004, 2005 Jerome Alet \- alet@librelogiciel.com 
     6pkturnkey v1.23alpha31_unofficial (c) 2003, 2004, 2005 Jerome Alet \- alet@librelogiciel.com 
    77.PP 
    88A turn key tool for PyKota. When launched, this command will initialize 
     
    1313command line usage : 
    1414.IP 
    15 pkturnkey [options] 
     15pkturnkey [options] [printqueues names] 
    1616.PP 
    1717options : 
     
    7575To REALLY initialize the database instead of simulating it, please 
    7676use the \fB\-f\fR | \fB\-\-force\fR command line switch. 
     77.IP 
     78You can limit the initialization to only a subset of the existing 
     79printers, by passing their names at the end of the command line. 
    7780.PP 
    7881This program is free software; you can redistribute it and/or modify 
  • pykota/trunk/man/el_GR/pkturnkey.1

    r2453 r2466  
    22.TH PKTURNKEY "1" "septembre 2005" "C@LL - Conseil Internet & Logiciels Libres" "User Commands" 
    33.SH NOM 
    4 pkturnkey \- page de manuel de pkturnkey 1.23alpha30_unofficial 
     4pkturnkey \- page de manuel de pkturnkey 1.23alpha31_unofficial 
    55.SH DESCRIPTION 
    6 pkturnkey v1.23alpha30_unofficial (c) 2003, 2004, 2005 Jerome Alet \- alet@librelogiciel.com 
     6pkturnkey v1.23alpha31_unofficial (c) 2003, 2004, 2005 Jerome Alet \- alet@librelogiciel.com 
    77.PP 
    88A turn key tool for PyKota. When launched, this command will initialize 
     
    1313command line usage : 
    1414.IP 
    15 pkturnkey [options] 
     15pkturnkey [options] [printqueues names] 
    1616.PP 
    1717options : 
     
    7575To REALLY initialize the database instead of simulating it, please 
    7676use the \fB\-f\fR | \fB\-\-force\fR command line switch. 
     77.IP 
     78You can limit the initialization to only a subset of the existing 
     79printers, by passing their names at the end of the command line. 
    7780.PP 
    7881This program is free software; you can redistribute it and/or modify 
  • pykota/trunk/man/es/pkturnkey.1

    r2453 r2466  
    22.TH PKTURNKEY "1" "septembre 2005" "C@LL - Conseil Internet & Logiciels Libres" "User Commands" 
    33.SH NOM 
    4 pkturnkey \- page de manuel de pkturnkey 1.23alpha30_unofficial 
     4pkturnkey \- page de manuel de pkturnkey 1.23alpha31_unofficial 
    55.SH DESCRIPTION 
    6 pkturnkey v1.23alpha30_unofficial (c) 2003, 2004, 2005 Jerome Alet \- alet@librelogiciel.com 
     6pkturnkey v1.23alpha31_unofficial (c) 2003, 2004, 2005 Jerome Alet \- alet@librelogiciel.com 
    77.PP 
    88A turn key tool for PyKota. When launched, this command will initialize 
     
    1313command line usage : 
    1414.IP 
    15 pkturnkey [options] 
     15pkturnkey [options] [printqueues names] 
    1616.PP 
    1717options : 
     
    7575To REALLY initialize the database instead of simulating it, please 
    7676use the \fB\-f\fR | \fB\-\-force\fR command line switch. 
     77.IP 
     78You can limit the initialization to only a subset of the existing 
     79printers, by passing their names at the end of the command line. 
    7780.PP 
    7881This program is free software; you can redistribute it and/or modify 
  • pykota/trunk/man/fr/pkturnkey.1

    r2453 r2466  
    22.TH PKTURNKEY "1" "septembre 2005" "C@LL - Conseil Internet & Logiciels Libres" "User Commands" 
    33.SH NOM 
    4 pkturnkey \- page de manuel de pkturnkey 1.23alpha30_unofficial 
     4pkturnkey \- page de manuel de pkturnkey 1.23alpha31_unofficial 
    55.SH DESCRIPTION 
    6 pkturnkey v1.23alpha30_unofficial (c) 2003, 2004, 2005 Jerome Alet \- alet@librelogiciel.com 
     6pkturnkey v1.23alpha31_unofficial (c) 2003, 2004, 2005 Jerome Alet \- alet@librelogiciel.com 
    77.PP 
    88A turn key tool for PyKota. When launched, this command will initialize 
     
    1313command line usage : 
    1414.IP 
    15 pkturnkey [options] 
     15pkturnkey [options] [printqueues names] 
    1616.PP 
    1717options : 
     
    7575To REALLY initialize the database instead of simulating it, please 
    7676use the \fB\-f\fR | \fB\-\-force\fR command line switch. 
     77.IP 
     78You can limit the initialization to only a subset of the existing 
     79printers, by passing their names at the end of the command line. 
    7780.PP 
    7881This program is free software; you can redistribute it and/or modify 
  • pykota/trunk/man/it/pkturnkey.1

    r2453 r2466  
    22.TH PKTURNKEY "1" "septembre 2005" "C@LL - Conseil Internet & Logiciels Libres" "User Commands" 
    33.SH NOM 
    4 pkturnkey \- page de manuel de pkturnkey 1.23alpha30_unofficial 
     4pkturnkey \- page de manuel de pkturnkey 1.23alpha31_unofficial 
    55.SH DESCRIPTION 
    6 pkturnkey v1.23alpha30_unofficial (c) 2003, 2004, 2005 Jerome Alet \- alet@librelogiciel.com 
     6pkturnkey v1.23alpha31_unofficial (c) 2003, 2004, 2005 Jerome Alet \- alet@librelogiciel.com 
    77.PP 
    88A turn key tool for PyKota. When launched, this command will initialize 
     
    1313command line usage : 
    1414.IP 
    15 pkturnkey [options] 
     15pkturnkey [options] [printqueues names] 
    1616.PP 
    1717options : 
     
    7575To REALLY initialize the database instead of simulating it, please 
    7676use the \fB\-f\fR | \fB\-\-force\fR command line switch. 
     77.IP 
     78You can limit the initialization to only a subset of the existing 
     79printers, by passing their names at the end of the command line. 
    7780.PP 
    7881This program is free software; you can redistribute it and/or modify 
  • pykota/trunk/man/nb_NO/pkturnkey.1

    r2453 r2466  
    22.TH PKTURNKEY "1" "septembre 2005" "C@LL - Conseil Internet & Logiciels Libres" "User Commands" 
    33.SH NOM 
    4 pkturnkey \- page de manuel de pkturnkey 1.23alpha30_unofficial 
     4pkturnkey \- page de manuel de pkturnkey 1.23alpha31_unofficial 
    55.SH DESCRIPTION 
    6 pkturnkey v1.23alpha30_unofficial (c) 2003, 2004, 2005 Jerome Alet \- alet@librelogiciel.com 
     6pkturnkey v1.23alpha31_unofficial (c) 2003, 2004, 2005 Jerome Alet \- alet@librelogiciel.com 
    77.PP 
    88A turn key tool for PyKota. When launched, this command will initialize 
     
    1313command line usage : 
    1414.IP 
    15 pkturnkey [options] 
     15pkturnkey [options] [printqueues names] 
    1616.PP 
    1717options : 
     
    7575To REALLY initialize the database instead of simulating it, please 
    7676use the \fB\-f\fR | \fB\-\-force\fR command line switch. 
     77.IP 
     78You can limit the initialization to only a subset of the existing 
     79printers, by passing their names at the end of the command line. 
    7780.PP 
    7881This program is free software; you can redistribute it and/or modify 
  • pykota/trunk/man/pkturnkey.1

    r2453 r2466  
    22.TH PKTURNKEY "1" "September 2005" "C@LL - Conseil Internet & Logiciels Libres" "User Commands" 
    33.SH NAME 
    4 pkturnkey \- manual page for pkturnkey 1.23alpha30_unofficial 
     4pkturnkey \- manual page for pkturnkey 1.23alpha31_unofficial 
    55.SH DESCRIPTION 
    6 pkturnkey v1.23alpha30_unofficial (c) 2003, 2004, 2005 Jerome Alet \- alet@librelogiciel.com 
     6pkturnkey v1.23alpha31_unofficial (c) 2003, 2004, 2005 Jerome Alet \- alet@librelogiciel.com 
    77.PP 
    88A turn key tool for PyKota. When launched, this command will initialize 
     
    1313command line usage : 
    1414.IP 
    15 pkturnkey [options] 
     15pkturnkey [options] [printqueues names] 
    1616.PP 
    1717options : 
     
    7575To REALLY initialize the database instead of simulating it, please 
    7676use the \fB\-f\fR | \fB\-\-force\fR command line switch. 
     77.IP 
     78You can limit the initialization to only a subset of the existing 
     79printers, by passing their names at the end of the command line. 
    7780.PP 
    7881This program is free software; you can redistribute it and/or modify 
  • pykota/trunk/man/pt_BR/pkturnkey.1

    r2453 r2466  
    22.TH PKTURNKEY "1" "septembre 2005" "C@LL - Conseil Internet & Logiciels Libres" "User Commands" 
    33.SH NOM 
    4 pkturnkey \- page de manuel de pkturnkey 1.23alpha30_unofficial 
     4pkturnkey \- page de manuel de pkturnkey 1.23alpha31_unofficial 
    55.SH DESCRIPTION 
    6 pkturnkey v1.23alpha30_unofficial (c) 2003, 2004, 2005 Jerome Alet \- alet@librelogiciel.com 
     6pkturnkey v1.23alpha31_unofficial (c) 2003, 2004, 2005 Jerome Alet \- alet@librelogiciel.com 
    77.PP 
    88A turn key tool for PyKota. When launched, this command will initialize 
     
    1313command line usage : 
    1414.IP 
    15 pkturnkey [options] 
     15pkturnkey [options] [printqueues names] 
    1616.PP 
    1717options : 
     
    7575To REALLY initialize the database instead of simulating it, please 
    7676use the \fB\-f\fR | \fB\-\-force\fR command line switch. 
     77.IP 
     78You can limit the initialization to only a subset of the existing 
     79printers, by passing their names at the end of the command line. 
    7780.PP 
    7881This program is free software; you can redistribute it and/or modify 
  • pykota/trunk/man/pt/pkturnkey.1

    r2453 r2466  
    22.TH PKTURNKEY "1" "septembre 2005" "C@LL - Conseil Internet & Logiciels Libres" "User Commands" 
    33.SH NOM 
    4 pkturnkey \- page de manuel de pkturnkey 1.23alpha30_unofficial 
     4pkturnkey \- page de manuel de pkturnkey 1.23alpha31_unofficial 
    55.SH DESCRIPTION 
    6 pkturnkey v1.23alpha30_unofficial (c) 2003, 2004, 2005 Jerome Alet \- alet@librelogiciel.com 
     6pkturnkey v1.23alpha31_unofficial (c) 2003, 2004, 2005 Jerome Alet \- alet@librelogiciel.com 
    77.PP 
    88A turn key tool for PyKota. When launched, this command will initialize 
     
    1313command line usage : 
    1414.IP 
    15 pkturnkey [options] 
     15pkturnkey [options] [printqueues names] 
    1616.PP 
    1717options : 
     
    7575To REALLY initialize the database instead of simulating it, please 
    7676use the \fB\-f\fR | \fB\-\-force\fR command line switch. 
     77.IP 
     78You can limit the initialization to only a subset of the existing 
     79printers, by passing their names at the end of the command line. 
    7780.PP 
    7881This program is free software; you can redistribute it and/or modify 
  • pykota/trunk/man/sv_SE/pkturnkey.1

    r2453 r2466  
    22.TH PKTURNKEY "1" "septembre 2005" "C@LL - Conseil Internet & Logiciels Libres" "User Commands" 
    33.SH NOM 
    4 pkturnkey \- page de manuel de pkturnkey 1.23alpha30_unofficial 
     4pkturnkey \- page de manuel de pkturnkey 1.23alpha31_unofficial 
    55.SH DESCRIPTION 
    6 pkturnkey v1.23alpha30_unofficial (c) 2003, 2004, 2005 Jerome Alet \- alet@librelogiciel.com 
     6pkturnkey v1.23alpha31_unofficial (c) 2003, 2004, 2005 Jerome Alet \- alet@librelogiciel.com 
    77.PP 
    88A turn key tool for PyKota. When launched, this command will initialize 
     
    1313command line usage : 
    1414.IP 
    15 pkturnkey [options] 
     15pkturnkey [options] [printqueues names] 
    1616.PP 
    1717options : 
     
    7575To REALLY initialize the database instead of simulating it, please 
    7676use the \fB\-f\fR | \fB\-\-force\fR command line switch. 
     77.IP 
     78You can limit the initialization to only a subset of the existing 
     79printers, by passing their names at the end of the command line. 
    7780.PP 
    7881This program is free software; you can redistribute it and/or modify 
  • pykota/trunk/man/th/pkturnkey.1

    r2453 r2466  
    22.TH PKTURNKEY "1" "septembre 2005" "C@LL - Conseil Internet & Logiciels Libres" "User Commands" 
    33.SH NOM 
    4 pkturnkey \- page de manuel de pkturnkey 1.23alpha30_unofficial 
     4pkturnkey \- page de manuel de pkturnkey 1.23alpha31_unofficial 
    55.SH DESCRIPTION 
    6 pkturnkey v1.23alpha30_unofficial (c) 2003, 2004, 2005 Jerome Alet \- alet@librelogiciel.com 
     6pkturnkey v1.23alpha31_unofficial (c) 2003, 2004, 2005 Jerome Alet \- alet@librelogiciel.com 
    77.PP 
    88A turn key tool for PyKota. When launched, this command will initialize 
     
    1313command line usage : 
    1414.IP 
    15 pkturnkey [options] 
     15pkturnkey [options] [printqueues names] 
    1616.PP 
    1717options : 
     
    7575To REALLY initialize the database instead of simulating it, please 
    7676use the \fB\-f\fR | \fB\-\-force\fR command line switch. 
     77.IP 
     78You can limit the initialization to only a subset of the existing 
     79printers, by passing their names at the end of the command line. 
    7780.PP 
    7881This program is free software; you can redistribute it and/or modify 
  • pykota/trunk/man/tr/pkturnkey.1

    r2453 r2466  
    22.TH PKTURNKEY "1" "septembre 2005" "C@LL - Conseil Internet & Logiciels Libres" "User Commands" 
    33.SH NOM 
    4 pkturnkey \- page de manuel de pkturnkey 1.23alpha30_unofficial 
     4pkturnkey \- page de manuel de pkturnkey 1.23alpha31_unofficial 
    55.SH DESCRIPTION 
    6 pkturnkey v1.23alpha30_unofficial (c) 2003, 2004, 2005 Jerome Alet \- alet@librelogiciel.com 
     6pkturnkey v1.23alpha31_unofficial (c) 2003, 2004, 2005 Jerome Alet \- alet@librelogiciel.com 
    77.PP 
    88A turn key tool for PyKota. When launched, this command will initialize 
     
    1313command line usage : 
    1414.IP 
    15 pkturnkey [options] 
     15pkturnkey [options] [printqueues names] 
    1616.PP 
    1717options : 
     
    7575To REALLY initialize the database instead of simulating it, please 
    7676use the \fB\-f\fR | \fB\-\-force\fR command line switch. 
     77.IP 
     78You can limit the initialization to only a subset of the existing 
     79printers, by passing their names at the end of the command line. 
    7780.PP 
    7881This program is free software; you can redistribute it and/or modify 
  • pykota/trunk/man/zh_TW/pkturnkey.1

    r2453 r2466  
    22.TH PKTURNKEY "1" "septembre 2005" "C@LL - Conseil Internet & Logiciels Libres" "User Commands" 
    33.SH NOM 
    4 pkturnkey \- page de manuel de pkturnkey 1.23alpha30_unofficial 
     4pkturnkey \- page de manuel de pkturnkey 1.23alpha31_unofficial 
    55.SH DESCRIPTION 
    6 pkturnkey v1.23alpha30_unofficial (c) 2003, 2004, 2005 Jerome Alet \- alet@librelogiciel.com 
     6pkturnkey v1.23alpha31_unofficial (c) 2003, 2004, 2005 Jerome Alet \- alet@librelogiciel.com 
    77.PP 
    88A turn key tool for PyKota. When launched, this command will initialize 
     
    1313command line usage : 
    1414.IP 
    15 pkturnkey [options] 
     15pkturnkey [options] [printqueues names] 
    1616.PP 
    1717options : 
     
    7575To REALLY initialize the database instead of simulating it, please 
    7676use the \fB\-f\fR | \fB\-\-force\fR command line switch. 
     77.IP 
     78You can limit the initialization to only a subset of the existing 
     79printers, by passing their names at the end of the command line. 
    7780.PP 
    7881This program is free software; you can redistribute it and/or modify 
  • pykota/trunk/NEWS

    r2465 r2466  
    2727          in pkprinters. These modes are now also honored when printing. 
    2828           
     29        - Allows the admin to restrict the number of print queues which will 
     30          be treated by pkturnkey by passing queues' names as additionnal  
     31          arguments on pkturnkey's command line. 
     32           
    2933    - 1.23alpha30 : 
    3034