Jeff Rush writes:
> Can a Zope-internals guru provide some enlightenment regarding the
> mysteries of __init__?
Are there mysteries?
I do not think so. "__init__" behaves in Zope exactly the same
as it does in Python.
It behaves differently than (most) other methods in that
its "self" is (of course) not acquisition wrapped.
> As I understand it, the use of __init__ should be avoided when
> possible, since it isn't invoked (necessarily) when persistent
> objects are reloaded from disk.
This is, as it should be.
"__init__" is only called when the object is created.
It would be wrong were it called when the object is loaded into
RAM (as this (logically) does not create the object).
> Therefore Zope tends to do instance
> init within manage_addMYPRODUCT global-to-Zope functions, although
> this doesn't seem to be fully consistent throughout the Zope
> community contributions.
It is bad style to do it this way.
The "manage_addMYPRODUCT" should not know internals about the
> The scenario is something like the following:
> def manage_addFolder(self, id, title='', ...):
> instance = Folder()
> instance.id = str(id)
> instance.title = title
> self._setObject(id, instance)
> class Folder(...):
> # no __init__ method
I do not think this is good style...
Zope-Dev maillist - [EMAIL PROTECTED]
** No cross posts or HTML encoding! **
(Related lists -