Changeset 2218 for pykota/trunk

Show
Ignore:
Timestamp:
04/24/05 18:16:22 (20 years ago)
Author:
jerome
Message:

The data dumper now supports filtering by hostname
or billing code.

Location:
pykota/trunk
Files:
5 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/bin/dumpykota

    r2216 r2218  
    8888         printername    Printer's name 
    8989         pgroupname     Printers group's name 
     90         hostname       Client's hostname 
     91         billingcode    Job's billing code 
    9092          
    9193  Contrary to other PyKota management tools, wildcard characters are not  
  • pykota/trunk/NEWS

    r2217 r2218  
    2424    - 1.22alpha8 : 
    2525     
     26        - The data dumper now accepts billingcode= and hostname= as 
     27          filters when dumping the job history. 
     28           
    2629        - The job billing code if present is now saved into the database, 
    2730          and exported to subprocesses as the PYKOTAJOBBILLING environment 
  • pykota/trunk/pykota/dumper.py

    r2217 r2218  
    6161                        "printername", 
    6262                        "pgroupname", 
     63                        "hostname", 
     64                        "billingcode", 
    6365                      ] 
    6466    def main(self, arguments, options, restricted=1) : 
     
    7577                        raise ValueError                 
    7678                except ValueError :     
    77                     raise PyKotaToolError, _("Invalid value [%s] for --filter command line option, see help.") % filterexp 
     79                    raise PyKotaToolError, _("Invalid filter value [%s], see help.") % filterexp 
    7880                else :     
    7981                    extractonly.update({ filterkey : filtervalue }) 
     
    9193            raise PyKotaToolError, _("XML output is disabled because the jaxml module is not available.") 
    9294             
    93         entries = getattr(self.storage, "extract%s" % datatype.title())(extractonly)     
     95        entries = getattr(self.storage, "extract%s" % datatype.title())(extractonly) 
    9496        if entries : 
    9597            mustclose = 0     
  • pykota/trunk/pykota/storages/ldapstorage.py

    r2217 r2218  
    10371037            self.doModify(pgroup.ident, fields)          
    10381038             
    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) : 
    10401040        """Retrieves all print jobs for user on printer (or all) before date, limited to first 100 results.""" 
    10411041        precond = "(objectClass=pykotaJob)" 
     
    10471047        if hostname is not None : 
    10481048            where.append("(pykotaHostName=%s)" % hostname) 
     1049        if billingcode is not None : 
     1050            where.append("(pykotaBillingCode=%s)" % self.userCharsetToDatabase(billingcode)) 
    10491051        if where :     
    10501052            where = "(&%s)" % "".join([precond] + where) 
     
    13261328        else :     
    13271329            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) 
    13291331        if entries : 
    13301332            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  
    4747            expressions = [] 
    4848            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)))) 
    5050            return " AND ".join(expressions)      
    5151        return ""