Changeset 3073

Show
Ignore:
Timestamp:
11/27/06 22:06:14 (17 years ago)
Author:
jerome
Message:

Now pkprinters doesn't modify CUPS' printers.conf if the -C | --cups
command line switch is not used.

Location:
pykota/trunk
Files:
33 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/bin/pkprinters

    r3052 r3073  
    5454   
    5555  -D | --description d Adds a textual description to printers. 
    56                         
     56 
     57  -C | --cups          Also modifies the DeviceURI in CUPS' printers.conf 
     58 
    5759  -c | --charge p[,j]  Sets the price per page and per job to charge. 
    5860                       Job price is optional. 
     
    171173            raise PyKotaCommandLineError, "%s : %s" % (pwd.getpwuid(os.geteuid())[0], _("You're not allowed to use this command.")) 
    172174             
     175        docups = options["cups"] 
     176         
    173177        if not options["list"] :     
    174178            percent = Percent(self) 
     
    202206            percent.display("\n%s..." % _("Deletion")) 
    203207            self.storage.deleteManyPrinters(printers) 
    204             percent.display("\n%s...\n" % _("Rerouting printers to CUPS")) 
    205             for printer in printers : 
    206                 uri = self.getPrinterDeviceURI(printer.Name) 
    207                 if self.isPrinterCaptured(deviceuri=uri) : 
    208                      newuri = uri.replace("cupspykota:", "") 
    209                      if newuri.startswith("//") : 
    210                          newuri = newuri[2:] 
    211                      self.regainPriv() # to avoid having to enter password. 
    212                      os.system('lpadmin -p "%s" -v "%s"' % (printer.Name, newuri)) 
    213                      self.logdebug("Printer %s rerouted to %s" % (printer.Name, newuri)) 
    214                      self.dropPriv()     
    215                 percent.oneMore() 
     208            if docups : 
     209                percent.display("\n%s...\n" % _("Rerouting printers to CUPS")) 
     210                for printer in printers : 
     211                    uri = self.getPrinterDeviceURI(printer.Name) 
     212                    if self.isPrinterCaptured(deviceuri=uri) : 
     213                         newuri = uri.replace("cupspykota:", "") 
     214                         if newuri.startswith("//") : 
     215                             newuri = newuri[2:] 
     216                         self.regainPriv() # to avoid having to enter password. 
     217                         os.system('lpadmin -p "%s" -v "%s"' % (printer.Name, newuri)) 
     218                         self.logdebug("Printer %s rerouted to %s" % (printer.Name, newuri)) 
     219                         self.dropPriv()     
     220                    percent.oneMore() 
    216221            percent.display("\n") 
    217222        else : 
     
    268273                            oldprinter = self.storage.addPrinter(printer)                
    269274                             
    270                             uri = self.getPrinterDeviceURI(printer.Name) 
    271                             if not self.isPrinterCaptured(deviceuri=uri) : 
    272                                  newuri = "cupspykota://%s" % uri 
    273                                  self.regainPriv() # to avoid having to enter password. 
    274                                  os.system('lpadmin -p "%s" -v "%s"' % (printer.Name, newuri)) 
    275                                  self.logdebug("Printer %s rerouted to %s" % (printer.Name, newuri)) 
    276                                  self.dropPriv() 
     275                            if docups : 
     276                                 uri = self.getPrinterDeviceURI(printer.Name) 
     277                                 if not self.isPrinterCaptured(deviceuri=uri) : 
     278                                      newuri = "cupspykota://%s" % uri 
     279                                      self.regainPriv() # to avoid having to enter password. 
     280                                      os.system('lpadmin -p "%s" -v "%s"' % (printer.Name, newuri)) 
     281                                      self.logdebug("Printer %s rerouted to %s" % (printer.Name, newuri)) 
     282                                      self.dropPriv() 
    277283                                      
    278284                            if oldprinter is not None : 
     
    315321    retcode = 0 
    316322    try : 
    317         short_options = "hvac:D:dg:lrsnpm:" 
    318         long_options = ["help", "version", "add", "charge=", "description=", \ 
     323        short_options = "hvaCc:D:dg:lrsnpm:" 
     324        long_options = ["help", "version", "add", "cups", "charge=", "description=", \ 
    319325                        "delete", "groups=", "list", "remove", \ 
    320326                        "skipexisting", "passthrough", "nopassthrough", \ 
     
    332338        options["version"] = options["v"] or options["version"] 
    333339        options["add"] = options["a"] or options["add"] 
     340        options["cups"] = options["C"] or options["cups"] 
    334341        options["charge"] = options["c"] or options["charge"] 
    335342        options["description"] = options["D"] or options["description"] 
  • pykota/trunk/man/de/pkprinters.1

    r3065 r3073  
    2929.HP 
    3030\fB\-D\fR | \fB\-\-description\fR d Adds a textual description to printers. 
     31.TP 
     32\fB\-C\fR | \fB\-\-cups\fR 
     33Also modifies the DeviceURI in CUPS' printers.conf 
    3134.TP 
    3235\fB\-c\fR | \fB\-\-charge\fR p[,j] 
  • pykota/trunk/man/el_GR/pkprinters.1

    r3065 r3073  
    2929.HP 
    3030\fB\-D\fR | \fB\-\-description\fR d Adds a textual description to printers. 
     31.TP 
     32\fB\-C\fR | \fB\-\-cups\fR 
     33Also modifies the DeviceURI in CUPS' printers.conf 
    3134.TP 
    3235\fB\-c\fR | \fB\-\-charge\fR p[,j] 
  • pykota/trunk/man/es/pkprinters.1

    r3065 r3073  
    2929.HP 
    3030\fB\-D\fR | \fB\-\-description\fR d Adds a textual description to printers. 
     31.TP 
     32\fB\-C\fR | \fB\-\-cups\fR 
     33Also modifies the DeviceURI in CUPS' printers.conf 
    3134.TP 
    3235\fB\-c\fR | \fB\-\-charge\fR p[,j] 
  • pykota/trunk/man/fr/pkprinters.1

    r3065 r3073  
    3030.HP 
    3131\fB\-D\fR | \fB\-\-description\fR d Ajoute une description textuelle aux imprimantes. 
     32.TP 
     33\fB\-C\fR | \fB\-\-cups\fR 
     34Modifie �lement la DeviceURI dans le fichier 
     35printers.conf de CUPS. 
    3236.TP 
    3337\fB\-c\fR | \fB\-\-charge\fR p[,j] 
  • pykota/trunk/man/it/pkprinters.1

    r3065 r3073  
    2929.HP 
    3030\fB\-D\fR | \fB\-\-description\fR d Adds a textual description to printers. 
     31.TP 
     32\fB\-C\fR | \fB\-\-cups\fR 
     33Also modifies the DeviceURI in CUPS' printers.conf 
    3134.TP 
    3235\fB\-c\fR | \fB\-\-charge\fR p[,j] 
  • pykota/trunk/man/nb_NO/pkprinters.1

    r3065 r3073  
    2929.HP 
    3030\fB\-D\fR | \fB\-\-description\fR d Adds a textual description to printers. 
     31.TP 
     32\fB\-C\fR | \fB\-\-cups\fR 
     33Also modifies the DeviceURI in CUPS' printers.conf 
    3134.TP 
    3235\fB\-c\fR | \fB\-\-charge\fR p[,j] 
  • pykota/trunk/man/pkprinters.1

    r3065 r3073  
    2929.HP 
    3030\fB\-D\fR | \fB\-\-description\fR d Adds a textual description to printers. 
     31.TP 
     32\fB\-C\fR | \fB\-\-cups\fR 
     33Also modifies the DeviceURI in CUPS' printers.conf 
    3134.TP 
    3235\fB\-c\fR | \fB\-\-charge\fR p[,j] 
  • pykota/trunk/man/pl/pkprinters.1

    r3065 r3073  
    2929.HP 
    3030\fB\-D\fR | \fB\-\-description\fR d Adds a textual description to printers. 
     31.TP 
     32\fB\-C\fR | \fB\-\-cups\fR 
     33Also modifies the DeviceURI in CUPS' printers.conf 
    3134.TP 
    3235\fB\-c\fR | \fB\-\-charge\fR p[,j] 
  • pykota/trunk/man/pt_BR/pkprinters.1

    r3065 r3073  
    2929.HP 
    3030\fB\-D\fR | \fB\-\-description\fR d Adds a textual description to printers. 
     31.TP 
     32\fB\-C\fR | \fB\-\-cups\fR 
     33Also modifies the DeviceURI in CUPS' printers.conf 
    3134.TP 
    3235\fB\-c\fR | \fB\-\-charge\fR p[,j] 
  • pykota/trunk/man/pt/pkprinters.1

    r3065 r3073  
    2929.HP 
    3030\fB\-D\fR | \fB\-\-description\fR d Adds a textual description to printers. 
     31.TP 
     32\fB\-C\fR | \fB\-\-cups\fR 
     33Also modifies the DeviceURI in CUPS' printers.conf 
    3134.TP 
    3235\fB\-c\fR | \fB\-\-charge\fR p[,j] 
  • pykota/trunk/man/sv_SE/pkprinters.1

    r3065 r3073  
    2929.HP 
    3030\fB\-D\fR | \fB\-\-description\fR d Adds a textual description to printers. 
     31.TP 
     32\fB\-C\fR | \fB\-\-cups\fR 
     33Also modifies the DeviceURI in CUPS' printers.conf 
    3134.TP 
    3235\fB\-c\fR | \fB\-\-charge\fR p[,j] 
  • pykota/trunk/man/th/pkprinters.1

    r3065 r3073  
    2929.HP 
    3030\fB\-D\fR | \fB\-\-description\fR d Adds a textual description to printers. 
     31.TP 
     32\fB\-C\fR | \fB\-\-cups\fR 
     33Also modifies the DeviceURI in CUPS' printers.conf 
    3134.TP 
    3235\fB\-c\fR | \fB\-\-charge\fR p[,j] 
  • pykota/trunk/man/tr/pkprinters.1

    r3065 r3073  
    2929.HP 
    3030\fB\-D\fR | \fB\-\-description\fR d Adds a textual description to printers. 
     31.TP 
     32\fB\-C\fR | \fB\-\-cups\fR 
     33Also modifies the DeviceURI in CUPS' printers.conf 
    3134.TP 
    3235\fB\-c\fR | \fB\-\-charge\fR p[,j] 
  • pykota/trunk/man/zh_TW/pkprinters.1

    r3065 r3073  
    2929.HP 
    3030\fB\-D\fR | \fB\-\-description\fR d Adds a textual description to printers. 
     31.TP 
     32\fB\-C\fR | \fB\-\-cups\fR 
     33Also modifies the DeviceURI in CUPS' printers.conf 
    3134.TP 
    3235\fB\-c\fR | \fB\-\-charge\fR p[,j] 
  • pykota/trunk/NEWS

    r3052 r3073  
    2222PyKota NEWS : 
    2323        
     24    - 1.25alpha17 (2006-11-27) : 
     25     
     26        - pkprinters now only modifies CUPS' printers.conf when the 
     27          -C | --cups command line switch is used. 
     28           
     29    - 1.25alpha16 (2006-11-12) : 
     30       
     31        - Several fixes to CGI scripts wrt i18n. 
     32         
     33        - Introduced the pkrefund command line tool to refund jobs. 
     34         
     35        - Several i18n fixes. 
     36         
     37        - Several minor fixes to documentation and translations. 
     38         
    2439    - 1.25alpha15 (2006-11-06) :    
    2540     
  • pykota/trunk/po/de/pykota.po

    r3069 r3073  
    17391739"  \n" 
    17401740"  -D | --description d Adds a textual description to printers.\n" 
    1741 "                       \n" 
     1741"\n" 
     1742"  -C | --cups          Also modifies the DeviceURI in CUPS' printers.conf\n" 
     1743"\n" 
    17421744"  -c | --charge p[,j]  Sets the price per page and per job to charge.\n" 
    17431745"                       Job price is optional.\n" 
  • pykota/trunk/po/el_GR/pykota.po

    r3069 r3073  
    17401740"  \n" 
    17411741"  -D | --description d Adds a textual description to printers.\n" 
    1742 "                       \n" 
     1742"\n" 
     1743"  -C | --cups          Also modifies the DeviceURI in CUPS' printers.conf\n" 
     1744"\n" 
    17431745"  -c | --charge p[,j]  Sets the price per page and per job to charge.\n" 
    17441746"                       Job price is optional.\n" 
  • pykota/trunk/po/es/pykota.po

    r3069 r3073  
    17561756"  \n" 
    17571757"  -D | --description d Adds a textual description to printers.\n" 
    1758 "                       \n" 
     1758"\n" 
     1759"  -C | --cups          Also modifies the DeviceURI in CUPS' printers.conf\n" 
     1760"\n" 
    17591761"  -c | --charge p[,j]  Sets the price per page and per job to charge.\n" 
    17601762"                       Job price is optional.\n" 
  • pykota/trunk/po/fr/pykota.po

    r3069 r3073  
    28102810"  \n" 
    28112811"  -D | --description d Adds a textual description to printers.\n" 
    2812 "                       \n" 
     2812"\n" 
     2813"  -C | --cups          Also modifies the DeviceURI in CUPS' printers.conf\n" 
     2814"\n" 
    28132815"  -c | --charge p[,j]  Sets the price per page and per job to charge.\n" 
    28142816"                       Job price is optional.\n" 
     
    29052907"  \n" 
    29062908"  -D | --description d Ajoute une description textuelle aux imprimantes.\n" 
    2907 "                       \n" 
     2909"\n" 
     2910"  -C | --cups          Modifie �lement la DeviceURI dans le fichier\n" 
     2911"                       printers.conf de CUPS.\n" 
     2912"\n" 
    29082913"  -c | --charge p[,j]  Fixes les co�ar page et par travail.\n" 
    29092914"                       Le co�r travail d'impression est optionnel.\n" 
  • pykota/trunk/po/it/pykota.po

    r3069 r3073  
    17421742"  \n" 
    17431743"  -D | --description d Adds a textual description to printers.\n" 
    1744 "                       \n" 
     1744"\n" 
     1745"  -C | --cups          Also modifies the DeviceURI in CUPS' printers.conf\n" 
     1746"\n" 
    17451747"  -c | --charge p[,j]  Sets the price per page and per job to charge.\n" 
    17461748"                       Job price is optional.\n" 
  • pykota/trunk/po/nb_NO/pykota.po

    r3069 r3073  
    17491749"  \n" 
    17501750"  -D | --description d Adds a textual description to printers.\n" 
    1751 "                       \n" 
     1751"\n" 
     1752"  -C | --cups          Also modifies the DeviceURI in CUPS' printers.conf\n" 
     1753"\n" 
    17521754"  -c | --charge p[,j]  Sets the price per page and per job to charge.\n" 
    17531755"                       Job price is optional.\n" 
  • pykota/trunk/po/pl/pykota.po

    r3069 r3073  
    22522252"  \n" 
    22532253"  -D | --description d Adds a textual description to printers.\n" 
    2254 "                       \n" 
     2254"\n" 
     2255"  -C | --cups          Also modifies the DeviceURI in CUPS' printers.conf\n" 
     2256"\n" 
    22552257"  -c | --charge p[,j]  Sets the price per page and per job to charge.\n" 
    22562258"                       Job price is optional.\n" 
     
    23502352"  \n" 
    23512353"  -D | --description d Dodaje opis tekstowy dla drukarki.\n" 
    2352 "                       \n" 
     2354"\n" 
     2355"  -C | --cups          Also modifies the DeviceURI in CUPS' printers.conf\n" 
     2356"\n" 
    23532357"  -c | --charge p[,j]  Ustala cen�a stron�raz za zadanie drukowania.\n" 
    23542358"                       Cena za zadanie drukowania jest argumentem " 
  • pykota/trunk/po/pt_BR/pykota.po

    r3072 r3073  
    17371737"  \n" 
    17381738"  -D | --description d Adds a textual description to printers.\n" 
    1739 "                       \n" 
     1739"\n" 
     1740"  -C | --cups          Also modifies the DeviceURI in CUPS' printers.conf\n" 
     1741"\n" 
    17401742"  -c | --charge p[,j]  Sets the price per page and per job to charge.\n" 
    17411743"                       Job price is optional.\n" 
  • pykota/trunk/po/pt/pykota.po

    r3069 r3073  
    17401740"  \n" 
    17411741"  -D | --description d Adds a textual description to printers.\n" 
    1742 "                       \n" 
     1742"\n" 
     1743"  -C | --cups          Also modifies the DeviceURI in CUPS' printers.conf\n" 
     1744"\n" 
    17431745"  -c | --charge p[,j]  Sets the price per page and per job to charge.\n" 
    17441746"                       Job price is optional.\n" 
  • pykota/trunk/po/pykota.pot

    r3069 r3073  
    17191719"  \n" 
    17201720"  -D | --description d Adds a textual description to printers.\n" 
    1721 "                       \n" 
     1721"\n" 
     1722"  -C | --cups          Also modifies the DeviceURI in CUPS' printers.conf\n" 
     1723"\n" 
    17221724"  -c | --charge p[,j]  Sets the price per page and per job to charge.\n" 
    17231725"                       Job price is optional.\n" 
  • pykota/trunk/po/sv_SE/pykota.po

    r3069 r3073  
    17551755"  \n" 
    17561756"  -D | --description d Adds a textual description to printers.\n" 
    1757 "                       \n" 
     1757"\n" 
     1758"  -C | --cups          Also modifies the DeviceURI in CUPS' printers.conf\n" 
     1759"\n" 
    17581760"  -c | --charge p[,j]  Sets the price per page and per job to charge.\n" 
    17591761"                       Job price is optional.\n" 
  • pykota/trunk/po/th/pykota.po

    r3069 r3073  
    17331733"  \n" 
    17341734"  -D | --description d Adds a textual description to printers.\n" 
    1735 "                       \n" 
     1735"\n" 
     1736"  -C | --cups          Also modifies the DeviceURI in CUPS' printers.conf\n" 
     1737"\n" 
    17361738"  -c | --charge p[,j]  Sets the price per page and per job to charge.\n" 
    17371739"                       Job price is optional.\n" 
  • pykota/trunk/po/tr/pykota.po

    r3069 r3073  
    17451745"  \n" 
    17461746"  -D | --description d Adds a textual description to printers.\n" 
    1747 "                       \n" 
     1747"\n" 
     1748"  -C | --cups          Also modifies the DeviceURI in CUPS' printers.conf\n" 
     1749"\n" 
    17481750"  -c | --charge p[,j]  Sets the price per page and per job to charge.\n" 
    17491751"                       Job price is optional.\n" 
  • pykota/trunk/po/zh_TW/pykota.po

    r3069 r3073  
    17251725"  \n" 
    17261726"  -D | --description d Adds a textual description to printers.\n" 
    1727 "                       \n" 
     1727"\n" 
     1728"  -C | --cups          Also modifies the DeviceURI in CUPS' printers.conf\n" 
     1729"\n" 
    17281730"  -c | --charge p[,j]  Sets the price per page and per job to charge.\n" 
    17291731"                       Job price is optional.\n" 
  • pykota/trunk/pykota/version.py

    r3053 r3073  
    2222# 
    2323 
    24 __version__ = "1.25alpha16_unofficial" 
     24__version__ = "1.25alpha17_unofficial" 
    2525 
    2626__doc__ = "PyKota : a complete Printing Quota Solution for CUPS."