[Product-Developers] IObjectInitializedEvent subscriber not triggered inside tests

Mike Rhodes mike at netsight.co.uk
Wed Aug 10 14:00:41 UTC 2011


We ended up just calling it manually in our tests:

from zope.event import notify
from Products.Archetypes.event import ObjectInitializedEvent

folder.invokeFactory('Page', 'new_page')
ob = folder['new_page']
notify(ObjectInitializedEvent(ob))

Would love to hear if there's a better way, however.

Mike.

On 09/08/2011 07:37, Andreas Jung wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Plone 4.X.
>
> I have an event subscriber registered for IObjectInitializedEvent.
> The subscriber is executed while creating a new object through the web
> but not when creating a new object inside a test using invokeFactory().
> Is there some test magic I am missing?
>
> Andreas
>
> - --
> ZOPYX Limited           | zopyx group
> Charlottenstr. 37/1     | The full-service network for Zope&  Plone
> D-72070 Tübingen        | Produce&  Publish
> www.zopyx.com           | www.produce-and-publish.com
> - ------------------------------------------------------------------------
> E-Publishing, Python, Zope&  Plone development, Consulting
>
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.11 (Darwin)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iQGUBAEBAgAGBQJOQNW8AAoJEADcfz7u4AZj9xMLvizftQMcLkaT3WWZDOjyzOZn
> Jaf1fHVjdoUJvQg8tdu2uFTjrJHtXfUojHAs5lB0LqxNfq1FSbOQgJcpKOr15DPE
> kpuLnJg4z+YjTHg7o++oFfZktV29uguckrwoof33fJ0rcSnXv7jtT9GHDqL/2ENb
> ad5FBPVuNsvxsAB4S/fFIwa29W8BiTpL8j2qB4/fFyv4HTIQtSXi7DcuWW++HYTk
> N1Lol4Ok9a4+owcLwpyLwUHqermhVOmRYSw/Mz97P29PVdq/b7ura3V7k+rXidLs
> mV0v7sWzjz/yhvpoZ1f/5vP5NT95YhGv6UL8Hy6FnFa2ZrQXvaHsoO2F6TGMDDr/
> OY1D61frZEBLiOUpHT24kQNz/57btrfZ0kajzjiOzzgvhIR5a5a7wIkjwFmXxr45
> 6+7P5gOkwDZX2GENhB7mTHR9BZRQ3VXKSbXVHpslMdaoCM+XSTwornoJGhiHCt0Z
> XP2U0WnyQu5Wmo15GaVHJPQIdo1jDeI=
> =q7fi
> -----END PGP SIGNATURE-----
>
>
>
> _______________________________________________
> Product-Developers mailing list
> Product-Developers at lists.plone.org
> https://lists.plone.org/mailman/listinfo/plone-product-developers

-- 
0117 909 0901 (ext. 23)
Netsight / www.netsight.co.uk


More information about the Product-Developers mailing list