Show
Ignore:
Timestamp:
07/01/04 19:45:49 (20 years ago)
Author:
jalet
Message:

Added code to handle the description field for printers

Files:
1 modified

Legend:

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

    r1531 r1582  
    2222# 
    2323# $Log$ 
     24# Revision 1.43  2004/07/01 17:45:49  jalet 
     25# Added code to handle the description field for printers 
     26# 
    2427# Revision 1.42  2004/06/08 17:44:43  jalet 
    2528# Payment now gets deleted when the user is deleted 
     
    115118            printer.ident = fields.get("id") 
    116119            printer.Name = fields.get("printername", printername) 
    117             printer.PricePerJob = fields.get("priceperjob") 
    118             printer.PricePerPage = fields.get("priceperpage") 
     120            printer.PricePerJob = fields.get("priceperjob") or 0.0 
     121            printer.PricePerPage = fields.get("priceperpage") or 0.0 
     122            printer.Description = fields.get("description") or "" 
    119123            printer.Exists = 1 
    120124        return printer     
     
    228232                    printer = StoragePrinter(self, record["printername"]) 
    229233                    printer.ident = record.get("id") 
    230                     printer.PricePerJob = record.get("priceperjob") 
    231                     printer.PricePerPage = record.get("priceperpage") 
     234                    printer.PricePerJob = record.get("priceperjob") or 0.0 
     235                    printer.PricePerPage = record.get("priceperpage") or 0.0 
     236                    printer.Description = record.get("description") or "" 
    232237                    printer.Exists = 1 
    233238                    printers.append(printer) 
     
    313318        self.doModify("UPDATE printers SET priceperpage=%s, priceperjob=%s WHERE id=%s" % (self.doQuote(printer.PricePerPage), self.doQuote(printer.PricePerJob), self.doQuote(printer.ident))) 
    314319         
     320    def writePrinterDescription(self, printer) :     
     321        """Write the printer's description back into the storage.""" 
     322        self.doModify("UPDATE printers SET description=%s WHERE id=%s" % (self.doQuote(printer.Description), self.doQuote(printer.ident))) 
     323         
    315324    def writeUserLimitBy(self, user, limitby) :     
    316325        """Sets the user's limiting factor."""