Changeset 2369

Show
Ignore:
Timestamp:
07/18/05 16:07:01 (19 years ago)
Author:
jerome
Message:

Ensures that the billing code is stored as an utf8 encoded string.

Files:
1 modified

Legend:

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

    r2342 r2369  
    225225            fields = result[0] 
    226226            code.ident = fields.get("id") 
    227             code.BillingCode = fields.get("billingcode", label) 
     227            code.BillingCode = self.databaseToUserCharset(fields.get("billingcode", label)) 
    228228            code.Description = self.databaseToUserCharset(fields.get("description") or "") 
    229229            code.Balance = fields.get("balance") or 0.0 
     
    361361        if result : 
    362362            for record in result : 
    363                 if self.tool.matchString(record["billingcode"], billingcodepattern.split(",")) : 
    364                     code = StorageBillingCode(self, record["billingcode"]) 
     363                bcode = self.databaseToUserCharset(record["billingcode"]) 
     364                if self.tool.matchString(bcode, billingcodepattern.split(",")) : 
     365                    code = StorageBillingCode(self, bcode) 
    365366                    code.ident = record.get("id") 
    366367                    code.Balance = record.get("balance") or 0.0 
     
    420421    def addBillingCode(self, label) :         
    421422        """Adds a billing code to the quota storage, returns it.""" 
    422         self.doModify("INSERT INTO billingcodes (billingcode) VALUES (%s)" % self.doQuote(label)) 
     423        self.doModify("INSERT INTO billingcodes (billingcode) VALUES (%s)" % self.doQuote(self.userCharsetToDatabase(label))) 
    423424        return self.getBillingCode(label) 
    424425         
     
    659660                 ] :   
    660661            self.doModify(q) 
    661              
    662          
     662