[Zope-CMF] overrideDiscussionFor() in discussion tool

Tim Terlegård tim at se.linux.org
Sat May 8 18:23:24 EDT 2004


> >overrideDiscussionFor(self, content, allowDiscussion):
> >    ...
> >    if allowDiscussion is None or allowDiscussion == 'None':
> >        if hasattr(content, 'allow_discussion'):
> >            del content.allow_discussion
> >    else:
> >        content.allow_discussion = int(allowDiscussion)
> >
> >
> >I get "KeyError: allow_discussion" from the del statement.
> >Does hasattr() use aquisition and del does not?
>
> >Perhaps this is a bug?
>
> Probably.
>
> You can try to replace "hasattr(content, 'allow_discussion')"
> by "content.__dict__.has_key('allow_discussion')".

I tried hasattr(aq_base(content), 'allow_discussion') and that worked.

So what do we do about this? Can anyone on this list confirm this and
fix it?

Tim




More information about the Zope-CMF mailing list