[ZPatterns] fixed in CVS (was re: Problem in latest ZPatterns: setattr, id, etc.)

Jean Jordaan [email protected]
Mon, 1 Oct 2001 16:19:18 +0200


Hi Steve, all 

The patch works, and I wanted to apply it locally in a site-wide manner, 
so I thought that a logical place to do this might be our checkout of the 
public ZPatterns CVS repository (anoncvs.eby-sarna.com). 

However, when doing this, I noticed that the '_v_parent' issue has been
addressed in CVS in August, but in a different manner from yours (that 
is, SteveA's). Here is the relevant snippet. This ZPatterns version also 
works for me. I'd be completely out of my depth if I tried to compare 
the two, but would like to ask which one should go in TransactionAgents?

Regards,
Jean

============================
File: DataSkins.py      Status: Up-to-date

   Working revision:    1.60
   Repository revision: 1.60    /cvsroot/ZProducts/ZPatterns/DataSkins.py,v
----------------------------
symbolic names:
    ZPatterns-0-4-3p2: 1.59
[...]
----------------------------
revision 1.60
date: 2001/08/13 17:00:53;  author: pje;  state: Exp;  lines: +48 -7
Added fixes for setId-before-__of__ problems.
----------------------------

    def __set_attr__(self,name,val,_v_dm_=_v_dm_):

        d = self.__dict__
        
        try:
            dm = d[_v_dm_]
        except KeyError:
            if name=='id' and val==d['id']: return
            raise

        if d.has_key('_v_parent'):
        
            # Only try providers if we're bound to a canonical parent
            
            self = self._canonicalForm()
            self._objectChanging(name)

            for ap in dm._getProvidersFor(self,'setattr',(name,'*')):
                if ap._SetAttributeFor(self,name,val):
                    return