[Zope-Coders] SimpleItem.getId busted
Casey Duncan
casey at zope.com
Thu Nov 20 13:50:15 EST 2003
On Thu, 20 Nov 2003 19:41:22 +0100
Florent Guillaume <fg at nuxeo.com> wrote:
> >
> > def getId(self):
> > try:
> > name = aq_base(self).id
> > except AttributeError:
> > try:
> > return self.__name__
> > except AttributeError:
> > raise AttributeError, 'This object has no name'
> > else:
> > try:
> > return name()
> > except TypeError:
> > return name
>
> Beware, if id is callable you'll end up calling aq_base(self).id() and
> not self.id() which can make a big difference...
Why would you want to call an acquired id method? Are you creating python scripts named id? ;^)
-Casey
More information about the Zope-Coders
mailing list