Show
Ignore:
Timestamp:
08/18/10 04:20:57 (14 years ago)
Author:
jerome
Message:

Removed support for the MaxJobSize? attribute for users group print quota
entries : I couldn't see a real use for this at the moment, and it would
complexify the code. This support might reappear later however. Added full
support for the MaxJobSize? attribute for user print quota entries,
editable with edpykota's new --maxjobsize command line switch. Changed
the internal handling of the MaxJobSize? attribute for printers :
internally 0 used to mean unlimited, it now allows one to forbid
printing onto a particular printer. The database upgrade script (only
for PostgreSQL) takes care of this.
IMPORTANT : the database schema changes. A database upgrade script is
provided for PostgreSQL only. The LDAP schema doesn't change to not
break any existing LDAP directory, so the pykotaMaxJobSize attribute is
still allowed on group print quota entries, but never used.
Seems to work as expected, for a change :-)
Fixes #15.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/pykota/storages/sql.py

    r3541 r3549  
    6262        printer.PricePerJob = record.get("priceperjob") or 0.0 
    6363        printer.PricePerPage = record.get("priceperpage") or 0.0 
    64         printer.MaxJobSize = record.get("maxjobsize") or 0 
     64        printer.MaxJobSize = record.get("maxjobsize") 
    6565        printer.PassThrough = record.get("passthrough") or 0 
    6666        if printer.PassThrough in (1, "1", "t", "true", "TRUE", "True") : 
     
    119119        userpquota.HardLimit = record.get("hardlimit") 
    120120        userpquota.DateLimit = record.get("datelimit") 
     121        userpquota.MaxJobSize = record.get("maxjobsize") 
    121122        userpquota.WarnCount = record.get("warncount") or 0 
    122123        userpquota.Exists = True 
     
    243244            thefilter = "AND %s" % thefilter 
    244245        orderby = self.createOrderBy(["+grouppquota.id"], ordering) 
    245         result = self.doRawSearch("SELECT groups.groupname,printers.printername,grouppquota.*,coalesce(sum(pagecounter), 0) AS pagecounter,coalesce(sum(lifepagecounter), 0) AS lifepagecounter FROM groups,printers,grouppquota,userpquota WHERE groups.id=grouppquota.groupid AND printers.id=grouppquota.printerid AND userpquota.printerid=grouppquota.printerid AND userpquota.userid IN (SELECT userid FROM groupsmembers WHERE groupsmembers.groupid=grouppquota.groupid) %(thefilter)s GROUP BY grouppquota.id,grouppquota.groupid,grouppquota.printerid,grouppquota.softlimit,grouppquota.hardlimit,grouppquota.datelimit,grouppquota.maxjobsize,groups.groupname,printers.printername ORDER BY %(orderby)s" % locals()) 
     246        result = self.doRawSearch("SELECT groups.groupname,printers.printername,grouppquota.*,coalesce(sum(pagecounter), 0) AS pagecounter,coalesce(sum(lifepagecounter), 0) AS lifepagecounter FROM groups,printers,grouppquota,userpquota WHERE groups.id=grouppquota.groupid AND printers.id=grouppquota.printerid AND userpquota.printerid=grouppquota.printerid AND userpquota.userid IN (SELECT userid FROM groupsmembers WHERE groupsmembers.groupid=grouppquota.groupid) %(thefilter)s GROUP BY grouppquota.id,grouppquota.groupid,grouppquota.printerid,grouppquota.softlimit,grouppquota.hardlimit,grouppquota.datelimit,groups.groupname,printers.printername ORDER BY %(orderby)s" % locals()) 
    246247        return self.prepareRawResult(result) 
    247248 
     
    560561                          % (self.doQuote(unicodeToDatabase(printer.Name)), \ 
    561562                             self.doQuote((printer.PassThrough and "t") or "f"), \ 
    562                              self.doQuote(printer.MaxJobSize or 0), \ 
     563                             self.doQuote(printer.MaxJobSize), \ 
    563564                             self.doQuote(unicodeToDatabase(printer.Description)), \ 
    564565                             self.doQuote(printer.PricePerPage or 0.0), \ 
     
    650651        if oldentry.Exists : 
    651652            return oldentry 
    652         self.doModify("INSERT INTO grouppquota (groupid, printerid, softlimit, hardlimit, datelimit, maxjobsize) VALUES (%s, %s, %s, %s, %s, %s)" \ 
     653        self.doModify("INSERT INTO grouppquota (groupid, printerid, softlimit, hardlimit, datelimit) VALUES (%s, %s, %s, %s, %s)" \ 
    653654                          % (self.doQuote(gpq.Group.ident), \ 
    654655                             self.doQuote(gpq.Printer.ident), \ 
    655656                             self.doQuote(gpq.SoftLimit), \ 
    656657                             self.doQuote(gpq.HardLimit), \ 
    657                              self.doQuote(gpq.DateLimit), \ 
    658                              self.doQuote(gpq.MaxJobSize))) 
     658                             self.doQuote(gpq.DateLimit))) 
    659659        gpq.isDirty = False 
    660660        return None # the entry created doesn't need further modification 
     
    664664        self.doModify("UPDATE printers SET passthrough=%s, maxjobsize=%s, description=%s, priceperpage=%s, priceperjob=%s WHERE id=%s" \ 
    665665                              % (self.doQuote((printer.PassThrough and "t") or "f"), \ 
    666                                  self.doQuote(printer.MaxJobSize or 0), \ 
     666                                 self.doQuote(printer.MaxJobSize), \ 
    667667                                 self.doQuote(unicodeToDatabase(printer.Description)), \ 
    668668                                 self.doQuote(printer.PricePerPage or 0.0), \