[Zope3-dev] Re: strange behavior of intid-utility

Tom Gross tom at lalisio.com
Mon Nov 20 04:55:18 EST 2006


Hi Jürgen,

    thanks for the explanation. But this is not a problem of the 
workflow. It is just a special case of the following situation:

>>> class MyContent(Persistent, Contained):

... 	""" """

>>> class MyContainer(BTreeContainer):

...	def __init__(self):

...		super(MyContainer, self).__init__()

...		self[u'foo'] = MyContent()


which raises a NotYet-exception with IntIds present, but not without. 
And it just uses core zope3 elements. Is this behavior intended?

Cheers
-Tom

  File "/usr/lib/python2.4/unittest.py", line 260, in run

    testMethod()

  File "/mnt/zope/ldev/var/zope/lib/python/myproduct/ftests.py", line 37, in test_withoutintids

    basic='mgr:mgrpw')

  File "/mnt/zope/ldev/app/zope3/lib/python/zope/app/testing/functional.py", line 357, in publish

    publish(request, handle_errors=handle_errors)

  File "/mnt/zope/ldev/app/zope3/lib/python/zope/publisher/publish.py", line 133, in publish

    result = publication.callObject(request, obj)

  File "/mnt/zope/ldev/app/zope3/lib/python/zope/app/publication/zopepublication.py", line 161, in callObject

    return mapply(ob, request.getPositionalArguments(), request)

  File "/mnt/zope/ldev/app/zope3/lib/python/zope/publisher/publish.py", line 108, in mapply

    return debug_call(obj, args)

  File "/mnt/zope/ldev/app/zope3/lib/python/zope/publisher/publish.py", line 114, in debug_call

    return obj(*args)

  File "/mnt/zope/ldev/app/zope3/lib/python/zope/app/container/browser/adding.py", line 142, in action

    content = factory()

  File "/mnt/zope/ldev/app/zope3/lib/python/zope/component/factory.py", line 37, in __call__

    return self._callable(*args, **kw)

  File "/mnt/zope/ldev/var/zope/lib/python/myproduct/ftests.py", line 27, in __init__

    self[u'foo'] = Content()

  File "/mnt/zope/ldev/app/zope3/lib/python/zope/app/container/sample.py", line 86, in __setitem__

    setitem(self, self.__data.__setitem__, key, object)

  File "/mnt/zope/ldev/app/zope3/lib/python/zope/app/container/contained.py", line 593, in setitem

    notify(event)

  File "/mnt/zope/ldev/app/zope3/lib/python/zope/event/__init__.py", line 23, in notify

    subscriber(event)

  File "/mnt/zope/ldev/app/zope3/lib/python/zope/component/event.py", line 26, in dispatch

    for ignored in zope.component.subscribers(event, None):

  File "/mnt/zope/ldev/app/zope3/lib/python/zope/component/_api.py", line 130, in subscribers

    return sitemanager.subscribers(objects, interface)

  File "/mnt/zope/ldev/app/zope3/lib/python/zope/component/registry.py", line 290, in subscribers

    return self.adapters.subscribers(objects, provided)

  File "/mnt/zope/ldev/app/zope3/lib/python/zope/interface/adapter.py", line 535, in subscribers

    subscription(*objects)

  File "/mnt/zope/ldev/app/zope3/lib/python/zope/component/event.py", line 33, in objectEventNotify

    adapters = zope.component.subscribers((event.object, event), None)

  File "/mnt/zope/ldev/app/zope3/lib/python/zope/component/_api.py", line 130, in subscribers

    return sitemanager.subscribers(objects, interface)

  File "/mnt/zope/ldev/app/zope3/lib/python/zope/component/registry.py", line 290, in subscribers

    return self.adapters.subscribers(objects, provided)

  File "/mnt/zope/ldev/app/zope3/lib/python/zope/interface/adapter.py", line 535, in subscribers

    subscription(*objects)

  File "/mnt/zope/ldev/app/zope3/lib/python/zope/app/intid/__init__.py", line 163, in addIntIdSubscriber

    key = IKeyReference(ob, None)

  File "/mnt/zope/ldev/app/zope3/lib/python/zope/app/component/hooks.py", line 96, in adapter_hook

    return siteinfo.adapter_hook(interface, object, name, default)

  File "/mnt/zope/ldev/app/zope3/lib/python/zope/security/adapter.py", line 88, in __call__

    adapter = self.factory(*args)

  File "/mnt/zope/ldev/app/zope3/lib/python/zope/app/keyreference/persistent.py", line 41, in __init__

    raise zope.app.keyreference.interfaces.NotYet(object)

NotYet: <myproduct.ftests.MyContent object at 0xb474982c>



Jürgen Kartnaller wrote:
> Hi Tom.
>
> The NotYet exception tells you, that the object you (or in this case 
> the IntId utility) want to get a key refence for is not "Not Yet" 
> connected to a database.
>
> Your specific case is reported here : 
> http://zope.org/Collectors/Zope3-dev/463
>
> Jürgen
>
> Tom Gross wrote:
>> Here is the traceback:
>>
>> Error in test test_withoutintids 
>> (myproduct.ftests.test_wf.WorkflowTestCase)
>> Traceback (most recent call last):
>>  File "/usr/lib/python2.4/unittest.py", line 260, in run
>>    testMethod()
>>  File "/mnt/zope/ldev/var/zope/lib/python/myproduct/ftests.py", line 
>> 20, in test_withoutintids
>>    basic='mgr:mgrpw')
>>  File 
>> "/mnt/zope/ldev/app/zope3/lib/python/zope/app/testing/functional.py", 
>> line 357, in publish
>>    publish(request, handle_errors=handle_errors)
>>  File 
>> "/mnt/zope/ldev/app/zope3/lib/python/zope/publisher/publish.py", line 
>> 133, in publish
>>    result = publication.callObject(request, obj)
>>  File 
>> "/mnt/zope/ldev/app/zope3/lib/python/zope/app/publication/zopepublication.py", 
>> line 161, in callObject
>>    return mapply(ob, request.getPositionalArguments(), request)
>>  File 
>> "/mnt/zope/ldev/app/zope3/lib/python/zope/publisher/publish.py", line 
>> 108, in mapply
>>    return debug_call(obj, args)
>>  File 
>> "/mnt/zope/ldev/app/zope3/lib/python/zope/publisher/publish.py", line 
>> 114, in debug_call
>>    return obj(*args)
>>  File 
>> "/mnt/zope/ldev/app/zope3/lib/python/zope/app/container/browser/adding.py", 
>> line 142, in action
>>    content = factory()
>>  File 
>> "/mnt/zope/ldev/app/zope3/lib/python/zope/component/factory.py", line 
>> 37, in __call__
>>    return self._callable(*args, **kw)
>>  File 
>> "/mnt/zope/ldev/app/zope3/lib/python/zope/app/workflow/stateful/definition.py", 
>> line 115, in __init__
>>    self.__states[self.getInitialStateName()] = initial
>>  File 
>> "/mnt/zope/ldev/app/zope3/lib/python/zope/app/workflow/definition.py", 
>> line 87, in __setitem__
>>    setitem(self, self.__data.__setitem__, name, object)
>>  File 
>> "/mnt/zope/ldev/app/zope3/lib/python/zope/app/container/contained.py", 
>> line 593, in setitem
>>    notify(event)
>>  File "/mnt/zope/ldev/app/zope3/lib/python/zope/event/__init__.py", 
>> line 23, in notify
>>    subscriber(event)
>>  File "/mnt/zope/ldev/app/zope3/lib/python/zope/component/event.py", 
>> line 26, in dispatch
>>    for ignored in zope.component.subscribers(event, None):
>>  File "/mnt/zope/ldev/app/zope3/lib/python/zope/component/_api.py", 
>> line 130, in subscribers
>>    return sitemanager.subscribers(objects, interface)
>>  File 
>> "/mnt/zope/ldev/app/zope3/lib/python/zope/component/registry.py", 
>> line 290, in subscribers
>>    return self.adapters.subscribers(objects, provided)
>>  File 
>> "/mnt/zope/ldev/app/zope3/lib/python/zope/interface/adapter.py", line 
>> 535, in subscribers
>>    subscription(*objects)
>>  File "/mnt/zope/ldev/app/zope3/lib/python/zope/component/event.py", 
>> line 33, in objectEventNotify
>>    adapters = zope.component.subscribers((event.object, event), None)
>>  File "/mnt/zope/ldev/app/zope3/lib/python/zope/component/_api.py", 
>> line 130, in subscribers
>>    return sitemanager.subscribers(objects, interface)
>>  File 
>> "/mnt/zope/ldev/app/zope3/lib/python/zope/component/registry.py", 
>> line 290, in subscribers
>>    return self.adapters.subscribers(objects, provided)
>>  File 
>> "/mnt/zope/ldev/app/zope3/lib/python/zope/interface/adapter.py", line 
>> 535, in subscribers
>>    subscription(*objects)
>>  File 
>> "/mnt/zope/ldev/app/zope3/lib/python/zope/app/intid/__init__.py", 
>> line 163, in addIntIdSubscriber
>>    key = IKeyReference(ob, None)
>>  File 
>> "/mnt/zope/ldev/app/zope3/lib/python/zope/app/component/hooks.py", 
>> line 96, in adapter_hook
>>    return siteinfo.adapter_hook(interface, object, name, default)
>>  File "/mnt/zope/ldev/app/zope3/lib/python/zope/security/adapter.py", 
>> line 88, in __call__
>>    adapter = self.factory(*args)
>>  File 
>> "/mnt/zope/ldev/app/zope3/lib/python/zope/app/keyreference/persistent.py", 
>> line 41, in __init__
>>    raise zope.app.keyreference.interfaces.NotYet(object)
>> NotYet: <zope.app.workflow.stateful.definition.State object at 
>> 0xb47b786c>
>>
>>
>> Philipp von Weitershausen wrote:
>>> Tom Gross wrote:
>>>>    I have a site with some utilities. One is a 
>>>> zope.app.intid.UniqueIdUtility, which seems to be the cause of the 
>>>> problem (see the test). A NotYet-Exception is raised, when I try to 
>>>> add a zope.app.workflow.StatefulProcessDefinition-object to the 
>>>> container with the utilities. I can add a 
>>>> StatefulProcessDefinition-object to an empty container. I'm using 
>>>> Zope 3.3 and Python 2.4.3.
>>>
>>> Got a traceback handy? (Remember: any error description should 
>>> *always be acocmpanied by a traceback, otherwise it's not very useful)
>>>
>>> I have a suspicion as to what this is about (something's missing a 
>>> __parent__ attribute), but I'd like to see the traceback first for 
>>> confirmation. Yes, I could execute the test somehow, but that would 
>>> take me a couple of minutes on my slow machine, and you already know 
>>> what the error is, so you can just as well describe it to me in 
>>> detail :). Note that providing a test is highly appreciated as it 
>>> helps with the reproduceability of the problem...
>>>
>>>
>>
>
> _______________________________________________
> Zope3-dev mailing list
> Zope3-dev at zope.org
> Unsub: http://mail.zope.org/mailman/options/zope3-dev/tom%40lalisio.com
>



More information about the Zope3-dev mailing list