[Zope-Coders] SimpleItem.getId busted
Casey Duncan
casey at zope.com
Thu Nov 20 10:12:09 EST 2003
On Thu, 20 Nov 2003 09:40:31 -0500
Casey Duncan <casey at zope.com> wrote:
[snip]
>
> The following might be safer (due to vagarities of the "callable" function with ExtensionClass instances). Also getattr(self, name, None) can be dangerous because it can mask read conflict errors. They would be very unlikely here, but probably not impossible. I'm not sure for example if it would be possible for self to be ghostified when getId is entered. It is definitely possible for a persistent object stored as "id" to be a ghost upon entry (however unlikely that senario may seem).
I asked Jim about this, and he informed me that self will never be a ghost entering a Python method. It can become a ghost later (like if you commit/abort a transaction within the method). So my paranoia about getattr(self, 'id', None) is probably unfounded, unless of course id is a callable persistent object, but this seems highly unlikely.
-Casey
More information about the Zope-Coders
mailing list