Show
Ignore:
Timestamp:
02/02/08 18:56:16 (16 years ago)
Author:
jerome
Message:

Moved some code elsewhere.
Minor changes to ensure that the job's ticket is correctly overwritten when needed.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/bin/cupspykota

    r3306 r3324  
    227227         
    228228        if not self.checkCUPSVersion() : 
    229             self.printInfo("BEWARE : CUPS is too old. You must use CUPS v1.3.4 or higher.", "error") 
     229            self.printInfo("BEWARE : CUPS is too old. You should use CUPS v1.3.4 or higher.", "error") 
    230230         
    231231        self.PrinterName = os.environ.get("PRINTER", "") 
     
    259259        self.UserName = self.Ticket.OriginatingUserName                              
    260260                                      
    261         self.DataFile = os.path.join(self.Directory, "%s-%s-%s-%s" % \ 
    262                    (self.myname, self.PrinterName, self.UserName, self.Ticket.JobId)) 
     261        self.DataFile = (os.path.join(self.Directory, "%s-%s-%s-%s" % \ 
     262                   (self.myname, self.PrinterName, self.UserName, self.Ticket.JobId)).encode(sys.getfilesystemencoding(), "replace") 
    263263         
    264264        muststartwith = "%s:" % self.myname 
     
    301301            self.OriginalJobBillingCode = None 
    302302        else :     
    303             self.Ticket.BillingCode = self.UTF8ToUserCharset(self.Ticket.BillingCode).decode("UTF-8") 
    304303            self.OriginalJobBillingCode = self.Ticket.BillingCode[:] 
    305304             
     
    416415                        action = "CANCEL" 
    417416                    elif line.startswith("USERNAME=") :     
    418                         username = self.userCharsetToUTF8(line.split("=", 1)[1].strip()).decode("UTF-8") 
     417                        username = line.split("=", 1)[1].strip().decode(self.charset, "replace") 
    419418                        self.logdebug("Seen new username [%s]" % username) 
    420419                    elif line.startswith("BILLINGCODE=") :     
    421                         billingcode = self.userCharsetToUTF8(line.split("=", 1)[1].strip()).decode("UTF-8") 
     420                        billingcode = line.split("=", 1)[1].strip().decode(self.charset, "replace") 
    422421                        self.logdebug("Seen new billing code [%s]" % billingcode) 
    423422                    elif line.startswith("REASON=") : 
    424                         reason = self.userCharsetToUTF8(line.split("=", 1)[1].strip()).decode("UTF-8") 
     423                        reason = line.split("=", 1)[1].strip().decode(self.charset, "replace") 
    425424                        self.logdebug("Seen new reason [%s]" % reason) 
    426425            except IOError, msg :