-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I have the following code for testing EasyNewsletter:

http://svn.plone.org/svn/collective/Products.EasyNewsletter/trunk/Products/EasyNewsletter/tests/test_enl.py


The invokeFactory('EasyNewsletter') call works on Plone 3
but fails on Plone 4 with Unauthorized (although I am Manager):

    self.portal.invokeFactory('EasyNewsletter', id='newsletter')
  File
"/home/ajung/.buildout/eggs/Products.CMFCore-2.2.2-py2.6.egg/Products/CMFCore/PortalFolder.py",
line 295, in invokeFactory
    return pt.constructContent(type_name, self, id, RESPONSE, *args, **kw)
  File
"/home/ajung/.buildout/eggs/Products.CMFCore-2.2.2-py2.6.egg/Products/CMFCore/TypesTool.py",
line 836, in constructContent
    ob = info.constructInstance(container, id, *args, **kw)
  File
"/home/ajung/.buildout/eggs/Products.CMFCore-2.2.2-py2.6.egg/Products/CMFCore/TypesTool.py",
line 312, in constructInstance
    raise AccessControl_Unauthorized('Cannot create %s' % self.getId())
Unauthorized: Cannot create EasyNewsletter


Digging deeper using pdb:

>
/home/ajung/.buildout/eggs/Products.CMFCore-2.2.2-py2.6.egg/Products/CMFCore/TypesTool.py(472)_queryFactoryMethod()
- -> def _queryFactoryMethod(self, container, default=None):
(Pdb) n
>
/home/ajung/.buildout/eggs/Products.CMFCore-2.2.2-py2.6.egg/Products/CMFCore/TypesTool.py(474)_queryFactoryMethod()
- -> if not self.product or not self.factory or container is None:
(Pdb)
>
/home/ajung/.buildout/eggs/Products.CMFCore-2.2.2-py2.6.egg/Products/CMFCore/TypesTool.py(478)_queryFactoryMethod()
- -> dispatcher = getattr(container, 'manage_addProduct', None)
(Pdb)
>
/home/ajung/.buildout/eggs/Products.CMFCore-2.2.2-py2.6.egg/Products/CMFCore/TypesTool.py(480)_queryFactoryMethod()
- -> if dispatcher is None:
(Pdb)
>
/home/ajung/.buildout/eggs/Products.CMFCore-2.2.2-py2.6.egg/Products/CMFCore/TypesTool.py(483)_queryFactoryMethod()
- -> try:
(Pdb)
>
/home/ajung/.buildout/eggs/Products.CMFCore-2.2.2-py2.6.egg/Products/CMFCore/TypesTool.py(484)_queryFactoryMethod()
- -> p = dispatcher[self.product]
(Pdb)
>
/home/ajung/.buildout/eggs/Products.CMFCore-2.2.2-py2.6.egg/Products/CMFCore/TypesTool.py(489)_queryFactoryMethod()
- -> m = getattr(p, self.factory, None)
(Pdb) print dispatcher
<App.FactoryDispatcher.ProductDispatcher object at 0x196f190>
(Pdb) print self.factory
addEasyNewsletter
(Pdb) n
>
/home/ajung/.buildout/eggs/Products.CMFCore-2.2.2-py2.6.egg/Products/CMFCore/TypesTool.py(491)_queryFactoryMethod()
- -> if m:
(Pdb) print m
None

Why does this fail on Plone 4?

Side note: adding an EasyNewsletter instance through the Plone UI
works both with Plone 3 and Plone 4.

Andreas


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQGUBAEBAgAGBQJM5o3nAAoJEADcfz7u4AZjcmULv2Z7UgrPVo7ClGepqnzm10H5
P266ughqWZcRZNig+LLFPBN6GSwW6hMY5xaUrZZ5C5yhDtKjhdsSJUB2a8VasDS5
LfrXtnbZYchFiQqJtOIwcMPYl7tTH1+0d0p6xlnj65ammD5YdJE7mrQ4ox8wj3WS
K/6rk6HK8HtxhM//ymW4i0xhslQMHAJ4nRzeRq88dDDE0rlUK2ZdRnS4jogS/Abg
lQ5cYFWE+BuKLSKyMSPa0pW9NkoP1gPsBzvnNj1edkEG4V8m9ajrJewtK72vohQU
4CcN11h5VdtZrK3dYE36/p/HO7XVR9+suWaNv16g23v8ME/2j3udO6UmA0ZDOsCK
UTKXEHIe1hYjpIhyguCbhLc6m8g6YL3RgaEP2/K/Hufdmw3O94+PKOV96yDcoN1V
CmE98pqvpTyhmFbjN3tERG2ZqT0hKRWL5WTajlQoKhBBf0v0k74xQOdDIMhnoK63
e5zHk2yK9+K1wIAtW078g7imPYGdhRM=
=/j62
-----END PGP SIGNATURE-----

<<attachment: lists.vcf>>

_______________________________________________
Product-Developers mailing list
[email protected]
http://lists.plone.org/mailman/listinfo/product-developers

Reply via email to