Changeset 2218 for pykota/trunk
- Timestamp:
- 04/24/05 18:16:22 (20 years ago)
- Location:
- pykota/trunk
- Files:
-
- 5 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/bin/dumpykota
r2216 r2218 88 88 printername Printer's name 89 89 pgroupname Printers group's name 90 hostname Client's hostname 91 billingcode Job's billing code 90 92 91 93 Contrary to other PyKota management tools, wildcard characters are not -
pykota/trunk/NEWS
r2217 r2218 24 24 - 1.22alpha8 : 25 25 26 - The data dumper now accepts billingcode= and hostname= as 27 filters when dumping the job history. 28 26 29 - The job billing code if present is now saved into the database, 27 30 and exported to subprocesses as the PYKOTAJOBBILLING environment -
pykota/trunk/pykota/dumper.py
r2217 r2218 61 61 "printername", 62 62 "pgroupname", 63 "hostname", 64 "billingcode", 63 65 ] 64 66 def main(self, arguments, options, restricted=1) : … … 75 77 raise ValueError 76 78 except ValueError : 77 raise PyKotaToolError, _("Invalid value [%s] for --filter command line option, see help.") % filterexp79 raise PyKotaToolError, _("Invalid filter value [%s], see help.") % filterexp 78 80 else : 79 81 extractonly.update({ filterkey : filtervalue }) … … 91 93 raise PyKotaToolError, _("XML output is disabled because the jaxml module is not available.") 92 94 93 entries = getattr(self.storage, "extract%s" % datatype.title())(extractonly) 95 entries = getattr(self.storage, "extract%s" % datatype.title())(extractonly) 94 96 if entries : 95 97 mustclose = 0 -
pykota/trunk/pykota/storages/ldapstorage.py
r2217 r2218 1037 1037 self.doModify(pgroup.ident, fields) 1038 1038 1039 def retrieveHistory(self, user=None, printer=None, datelimit=None, hostname=None, limit=100) :1039 def retrieveHistory(self, user=None, printer=None, datelimit=None, hostname=None, billingcode=None, limit=100) : 1040 1040 """Retrieves all print jobs for user on printer (or all) before date, limited to first 100 results.""" 1041 1041 precond = "(objectClass=pykotaJob)" … … 1047 1047 if hostname is not None : 1048 1048 where.append("(pykotaHostName=%s)" % hostname) 1049 if billingcode is not None : 1050 where.append("(pykotaBillingCode=%s)" % self.userCharsetToDatabase(billingcode)) 1049 1051 if where : 1050 1052 where = "(&%s)" % "".join([precond] + where) … … 1326 1328 else : 1327 1329 printer = None 1328 entries = self.retrieveHistory(user, printer, limit=None)1330 entries = self.retrieveHistory(user, printer, hostname=extractonly.get("hostname"), billingcode=extractonly.get("billingcode"), limit=None) 1329 1331 if entries : 1330 1332 result = [ ("username", "printername", "dn", "jobid", "pagecounter", "jobsize", "action", "jobdate", "filename", "title", "copies", "options", "jobprice", "hostname", "jobsizebytes", "md5sum", "pages", "billingcode") ] -
pykota/trunk/pykota/storages/sql.py
r2217 r2218 47 47 expressions = [] 48 48 for (k, v) in only.items() : 49 expressions.append("%s=%s" % (k, self.doQuote( v)))49 expressions.append("%s=%s" % (k, self.doQuote(self.userCharsetToDatabase(v)))) 50 50 return " AND ".join(expressions) 51 51 return ""