On 6/19/07, Stephan Richter <[EMAIL PROTECTED]> wrote:
On Tuesday 19 June 2007 09:53, Jan-Wijbrand Kolman wrote:
> Is there a way to overcome this? (or to put it differently, why is
> "my" utility created when the action object is created and not just
> before the actual registration?)
Unfortunately, there is no fix for this the way you want. It is simply not
implemented the way you expect. Having said that, I consider the urrent
behavior a bug or a mis-feature at best. I do not see how delaying the
instatiation would break any existing code, so changing the code would be a
viable solution.
I had a quick look into this yesterdag. My (proably naive) idea was to
add an keyword argument to registerUtility telling that the component
is a factory and needs to be instantiated before actual registration.
Something like:
def registerUtility(
self, component, provided=None, name=u'', info=u'',
event=True, is_factory=False):
...
if is_factory:
component = component()
...
When the action object is constructed, this is_factory argument can be
passed with it.
But:
1) Maybe this part of the discussion should be on zope3-dev, I realize
2) Phillip provided me with the following insight: "Don't register
during import time. Don't look up during registration time" [1],
which, well, makes sense to me. In that sense, the current behaviour
is not a bug at all, nor a feature. Just an implementation detail that
should not be relevant.
Maybe I need to rethink what I am trying to accomplish...
Kind regards,
jw
[1] http://permalink.gmane.org/gmane.comp.web.zope.grok.devel/1332
--
Jan-Wijbrand Kolman
_______________________________________________
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users