[Zope-dev] ZPatterns bug with patch

Steve Alexander steve@cat-box.net
Mon, 28 Aug 2000 23:33:38 +0100


> "Phillip J. Eby" wrote:
> > 
> > try:
> >     dm = self.__dict__[_v_dm_]
> > except KeyError:
> >     if name=='id' and val==self.__dict__['id']: return
> >     raise
> > 
> > Hopefully this should only perform the extra computations when the first
> > part fails...
>
> Are Python classes derived from DataSkin supposed to call
> DataSkin.__init__ ?
>
> Anyway, perhaps this would be a small improvement:
>
> try:
>     dm = self.__dict__[_v_dm_]
> except KeyError:
>     if (name=='id' and self.__dict__.has_key('id') 
>         and val==self.__dict__['id']): return
>     raise

What rubbish! I didn't mean that at all!

I think what I meant was this:

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


--
Steve Alexander
Software Engineer
Cat-Box limited
http://www.cat-box.net