On Thursday, September 25, 2003, at 05:18 PM, Luke Opperman wrote:
> The error happens during the second call to addColumn, and only if I
> import
> StoryMotivation before Motivation (otherwise the rogue code below
> never gets
> called due to how needSet works).
>
> addNeedSet snippet:
> cls = findClass(setCls, registry=registry)
> if callable(getattr(obj, attr, None)):
> getattr(obj, attr)(cls)
> else:
> setattr(obj, attr, cls)
>
> I'm trying to understand the reason for trying to create an instance
> of the
> class in the positive if statement. My code works if I comment that
> out (ie,
> if obj.attr already exists, then pass, otherwise set it) or just
> always set
> it. But ?
This is so that addNeedSet/setNeedSet allow both callbacks and
attribute setting (callbacks being more general). The particular
problem here is already fixed in CVS.
Ian
|