Show
Ignore:
Timestamp:
03/02/06 12:37:52 (18 years ago)
Author:
jerome
Message:

pkusers is now optimized like pkprinters, pkbcodes and edpykota.

Files:
1 modified

Legend:

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

    r2768 r2773  
    909909         
    910910    def addUser(self, user) :         
    911         """Adds a user to the quota storage, returns it.""" 
     911        """Adds a user to the quota storage, returns the old value if it already exists.""" 
     912        oldentry = self.getUser(user.Name) 
     913        if oldentry.Exists : 
     914            return oldentry # we return the existing entry 
    912915        uname = self.userCharsetToDatabase(user.Name) 
    913916        newfields = { 
     
    971974                dn = "%s=%s,%s" % (self.info["balancerdn"], uname, self.info["balancebase"]) 
    972975                self.doAdd(dn, fields) 
    973              
    974         return self.getUser(user.Name) 
     976        user.idbalance = dn 
     977        if user.PaymentsBacklog : 
     978            for (value, comment) in user.PaymentsBacklog : 
     979                self.writeNewPayment(user, value, comment) 
     980            user.PaymentsBacklog = [] 
     981        user.isDirty = False 
     982        return None # the entry created doesn't need further modification 
    975983         
    976984    def addGroup(self, group) :         
    977         """Adds a group to the quota storage, returns it.""" 
     985        """Adds a group to the quota storage, returns the old value if it already exists.""" 
     986        oldentry = self.getGroup(group.Name) 
     987        if oldentry.Exists : 
     988            return oldentry # we return the existing entry 
    978989        gname = self.userCharsetToDatabase(group.Name) 
    979990        newfields = {  
     
    10141025            dn = "%s=%s,%s" % (self.info["grouprdn"], gname, self.info["groupbase"]) 
    10151026            self.doAdd(dn, fields) 
    1016         return self.getGroup(group.Name) 
     1027        group.isDirty = False 
     1028        return None # the entry created doesn't need further modification 
    10171029         
    10181030    def addUserToGroup(self, user, group) :