[Product-Developers] how to enable Global Allow in code?

Nathan Van Gheem vangheem at gmail.com
Thu Dec 1 15:52:18 UTC 2011


I think you can work around the allowable type checks. Not positive this
works, but give something like this a try:

pt = getToolByName(portal, 'portal_types')
type_info = pt.getTypeInfo('MyPortalType')
ob = type_info._constructInstance(portal, id)


On Thu, Dec 1, 2011 at 9:47 AM, Maarten Nieber <maarten at usecm.com> wrote:

> Hi,
>
> in my test, I would like to temporarily enable Global Allow for my content
> type,
> so that I can directly instantiate it with invokeFactory (otherwise, I
> would
> have to first instantiate a whole bunch of other content types that are
> unrelated to my test).
>
> In the pdb debugger, I can get access to getSite()['portal_types'], and I
> assume
> that somewhere inside this object I can change the Global Allow setting
> for my
> content type.
>
> Does anyone know where I should look further?
>
> Thanks!
> Maarten
>
>
> _______________________________________________
> Product-Developers mailing list
> Product-Developers at lists.plone.org
> https://lists.plone.org/mailman/listinfo/plone-product-developers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.plone.org/pipermail/plone-product-developers/attachments/20111201/0bbec7b9/attachment.html>


More information about the Product-Developers mailing list