- Timestamp:
- 05/06/04 14:37:47 (21 years ago)
- Location:
- pykota/trunk
- Files:
-
- 1 added
- 15 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/bin/pkpgcounter
r1449 r1451 24 24 # 25 25 # $Log$ 26 # Revision 1.5 2004/05/06 12:37:29 jalet 27 # pkpgcounter : comments 28 # pkprinters : when --add is used, existing printers are now skipped. 29 # 26 30 # Revision 1.4 2004/05/04 12:21:55 jalet 27 31 # Now uses mmap in PCL mode … … 88 92 # Backported from C to Python by Jerome Alet, then enhanced 89 93 # with more PCL tags detected. I think all the necessary PCL tags 90 # are recognized to correctly handle PCL5e files wrt their number 91 # of pages 92 # 94 # are recognized to correctly handle PCL5 files wrt their number 95 # of pages. The documentation used for this was : 96 # 97 # HP PCL/PJL Reference Set 98 # PCL5 Printer Language Technical Quick Reference Guide 99 # http://h20000.www2.hp.com/bc/docs/support/SupportManual/bpl13205/bpl13205.pdf 100 # 93 101 infileno = infile.fileno() 94 102 infile = mmap.mmap(infileno, os.fstat(infileno).st_size, access=mmap.ACCESS_READ) 95 tagsends = { "&n" : "W", "&b": "W", "*i" : "W", "*l" : "W", "*m" : "W", "*v": "W", "*c" : "W", "(f" : "W", "*b" : "VW", "(s" : "W", ")s" : "W", "&p" : "X", "&l" : "X" } 103 tagsends = { "&n" : "W", 104 "&b" : "W", 105 "*i" : "W", 106 "*l" : "W", 107 "*m" : "W", 108 "*v" : "W", 109 "*c" : "W", 110 "(f" : "W", 111 "*b" : "VW", 112 "(s" : "W", 113 ")s" : "W", 114 "&p" : "X", 115 "&l" : "X" } 96 116 copies = 1 97 117 pagecount = 0 -
pykota/trunk/bin/pkprinters
r1438 r1451 24 24 # 25 25 # $Log$ 26 # Revision 1.6 2004/05/06 12:37:29 jalet 27 # pkpgcounter : comments 28 # pkprinters : when --add is used, existing printers are now skipped. 29 # 26 30 # Revision 1.5 2004/04/16 16:52:09 jalet 27 31 # Better formatting … … 163 167 for pname in names : 164 168 printer = self.storage.getPrinter(pname) 165 if not printer.Exists : 169 if printer.Exists : 170 self.logger.log_message(_("Printer %s already exists, skipping.") % printer.Name, "warn") 171 else : 166 172 if self.isValidName(pname) : 167 173 printer = self.storage.addPrinter(pname) 168 174 if not printer.Exists : 169 175 raise PyKotaToolError, _("Impossible to add printer %s") % pname 176 else : 177 printers.append(printer) 170 178 else : 171 179 raise PyKotaToolError, _("Invalid printer name %s") % pname 172 printers.append(printer)173 180 else : 174 181 printers = self.storage.getMatchingPrinters(",".join(names)) -
pykota/trunk/NEWS
r1450 r1451 22 22 PyKota NEWS : 23 23 24 - 1.19alpha5 : 25 26 - pkprinters --add now completely skips existing printers, but 27 logs a warning. 28 24 29 - 1.19alpha4 : 25 30 … … 27 32 is now fixed. 28 33 29 - improved PCL support in pkpgcounter. 34 - improved PCL support in pkpgcounter, with the use of 35 HP PCL/PJL Reference Set 36 PCL5 Printer Language Technical Quick Reference Guide 30 37 31 38 - pkpgcounter now uses mmap to speed things up : duration -
pykota/trunk/po/br/pykota.po
r1437 r1451 482 482 msgid "in" 483 483 msgstr "em" 484 485 #, python-format 486 msgid "Printer %s already exists, skipping." 487 msgstr "" 488 -
pykota/trunk/po/en/pykota.po
r1437 r1451 446 446 msgid "in" 447 447 msgstr "" 448 449 #, python-format 450 msgid "Printer %s already exists, skipping." 451 msgstr "" 452 -
pykota/trunk/po/es/pykota.po
r1437 r1451 486 486 msgid "in" 487 487 msgstr "en" 488 489 #, python-format 490 msgid "Printer %s already exists, skipping." 491 msgstr "" 492 -
pykota/trunk/po/fr/pykota.po
r1437 r1451 473 473 msgid "in" 474 474 msgstr "dans" 475 476 #, python-format 477 msgid "Printer %s already exists, skipping." 478 msgstr "L'imprimante %s existe d�, ignor�" 479 -
pykota/trunk/po/it/pykota.po
r1413 r1451 479 479 msgid "Problem modifying LDAP entry (%s, %s)" 480 480 msgstr "Errore avvenuto durante la modifica della entry LDAP (%s, %s)" 481 482 #, python-format 483 msgid "Printer %s already exists, skipping." 484 msgstr "" 485 -
pykota/trunk/po/pt/pykota.po
r1437 r1451 482 482 msgid "in" 483 483 msgstr "em" 484 485 #, python-format 486 msgid "Printer %s already exists, skipping." 487 msgstr "" 488 -
pykota/trunk/po/pykota.pot
r1437 r1451 446 446 msgid "in" 447 447 msgstr "" 448 449 #, python-format 450 msgid "Printer %s already exists, skipping." 451 msgstr "" 452 -
pykota/trunk/po/se/pykota.po
r1413 r1451 478 478 msgid "Problem modifying LDAP entry (%s, %s)" 479 479 msgstr "Problem med att modifiera LDAP post (%s, %s)" 480 481 #, python-format 482 msgid "Printer %s already exists, skipping." 483 msgstr "" 484 -
pykota/trunk/pykota/storages/ldapstorage.py
r1393 r1451 22 22 # 23 23 # $Log$ 24 # Revision 1.63 2004/05/06 12:37:46 jalet 25 # pkpgcounter : comments 26 # pkprinters : when --add is used, existing printers are now skipped. 27 # 24 28 # Revision 1.62 2004/03/05 14:31:58 jalet 25 29 # Improvement on strange history entries … … 444 448 """Extracts user information given its name.""" 445 449 user = StorageUser(self, username) 446 result = self.doSearch("(&(objectClass=pykotaAccount)(|(pykotaUserName=%s)(%s=%s)))" % (username, self.info["userrdn"], username), ["pykota LimitBy", self.info["usermail"]], base=self.info["userbase"])450 result = self.doSearch("(&(objectClass=pykotaAccount)(|(pykotaUserName=%s)(%s=%s)))" % (username, self.info["userrdn"], username), ["pykotaUserName", "pykotaLimitBy", self.info["usermail"]], base=self.info["userbase"]) 447 451 if result : 448 452 fields = result[0][1] 449 453 user.ident = result[0][0] 454 user.Name = fields.get("pykotaUserName", [username])[0] 450 455 user.Email = fields.get(self.info["usermail"]) 451 456 if user.Email is not None : … … 478 483 """Extracts group information given its name.""" 479 484 group = StorageGroup(self, groupname) 480 result = self.doSearch("(&(objectClass=pykotaGroup)(|(pykotaGroupName=%s)(%s=%s)))" % (groupname, self.info["grouprdn"], groupname), ["pykota LimitBy"], base=self.info["groupbase"])485 result = self.doSearch("(&(objectClass=pykotaGroup)(|(pykotaGroupName=%s)(%s=%s)))" % (groupname, self.info["grouprdn"], groupname), ["pykotaGroupName", "pykotaLimitBy"], base=self.info["groupbase"]) 481 486 if result : 482 487 fields = result[0][1] 483 488 group.ident = result[0][0] 489 group.Name = fields.get("pykotaGroupName", [groupname])[0] 484 490 group.LimitBy = fields.get("pykotaLimitBy") 485 491 if group.LimitBy is not None : … … 495 501 496 502 def getPrinterFromBackend(self, printername) : 497 """Extracts printer information given its name ."""503 """Extracts printer information given its name : returns first matching printer.""" 498 504 printer = StoragePrinter(self, printername) 499 result = self.doSearch("(&(objectClass=pykotaPrinter)(|(pykotaPrinterName=%s)(%s=%s)))" % (printername, self.info["printerrdn"], printername), ["pykotaPri cePerPage", "pykotaPricePerJob", "uniqueMember"], base=self.info["printerbase"])500 if result : 501 fields = result[0][1] 505 result = self.doSearch("(&(objectClass=pykotaPrinter)(|(pykotaPrinterName=%s)(%s=%s)))" % (printername, self.info["printerrdn"], printername), ["pykotaPrinterName", "pykotaPricePerPage", "pykotaPricePerJob", "uniqueMember"], base=self.info["printerbase"]) 506 if result : 507 fields = result[0][1] # take only first matching printer, ignore the rest 502 508 printer.ident = result[0][0] 509 printer.Name = fields.get("pykotaPrinterName", [printername])[0] 503 510 printer.PricePerJob = float(fields.get("pykotaPricePerJob", [0.0])[0] or 0.0) 504 511 printer.PricePerPage = float(fields.get("pykotaPricePerPage", [0.0])[0] or 0.0) -
pykota/trunk/pykota/storages/sql.py
r1358 r1451 22 22 # 23 23 # $Log$ 24 # Revision 1.38 2004/05/06 12:37:47 jalet 25 # pkpgcounter : comments 26 # pkprinters : when --add is used, existing printers are now skipped. 27 # 24 28 # Revision 1.37 2004/02/23 22:53:21 jalet 25 29 # Don't retrieve data when it's not needed, to avoid database queries … … 63 67 fields = result[0] 64 68 user.ident = fields.get("id") 69 user.Name = fields.get("username", username) 65 70 user.LimitBy = fields.get("limitby") 66 71 user.AccountBalance = fields.get("balance") … … 77 82 fields = result[0] 78 83 group.ident = fields.get("id") 84 group.Name = fields.get("groupname", groupname) 79 85 group.LimitBy = fields.get("limitby") 80 86 result = self.doSearch("SELECT SUM(balance) AS balance, SUM(lifetimepaid) AS lifetimepaid FROM users WHERE id IN (SELECT userid FROM groupsmembers WHERE groupid=%s)" % self.doQuote(group.ident)) … … 93 99 fields = result[0] 94 100 printer.ident = fields.get("id") 101 printer.Name = fields.get("printername", printername) 95 102 printer.PricePerJob = fields.get("priceperjob") 96 103 printer.PricePerPage = fields.get("priceperpage") -
pykota/trunk/pykota/version.py
r1447 r1451 22 22 # 23 23 24 __version__ = "1.19alpha 4_unofficial"24 __version__ = "1.19alpha5_unofficial" 25 25 26 26 __doc__ = """PyKota : a complete Printing Quota Solution for CUPS and LPRng."""