Changeset 2372

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

More work on billing codes and LDAP, not finished yet.

Files:
1 modified

Legend:

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

    r2358 r2372  
    13661366            return result 
    13671367             
     1368    def getBillingCodeFromBackend(self, label) : 
     1369        """Extracts billing code information given its label : returns first matching billing code.""" 
     1370        code = StorageBillingCode(self, label) 
     1371        result = self.doSearch("(&(objectClass=pykotaBilling)(pykotaBillingCode=%s))" % label), ["pykotaBillingCode", "pykotaBalance", "pykotaPageCounter", "description"], base=self.info["billingcodebase"]) 
     1372        if result : 
     1373            fields = result[0][1]       # take only first matching code, ignore the rest 
     1374            code.ident = result[0][0] 
     1375            code.BillingCode = self.databaseToUserCharset(fields.get("pykotaBillingCode", [self.userCharsetToDatabase(label)])[0]) 
     1376            code.PageCounter = int(fields.get("pykotaPageCounter", [0])[0]) 
     1377            code.Balance = float(fields.get("pykotaBalance", [0.0])[0]) 
     1378            code.Description = self.databaseToUserCharset(fields.get("description", [""])[0])  
     1379            code.Exists = 1 
     1380        return code     
    13681381             
    13691382# def getBillingCodeFromBackend(self, label) :