[Product-Developers] Folder constraints not applicable to custom content-types

Andreas Jung lists at zopyx.com
Mon Feb 28 12:35:40 UTC 2011


Plone 4.0.3

I have a custom content-types AuthoringPublishedContent (derived from
ATDocument).

Instances of this type should be created as content of some folder generated
by some backend
logic (and only there). That's why the content-types is not implictly
addable.

On the destination folder I enabled folder restrictions

        # ensure folder restrictions on destination folder
        dest_folder.setConstrainTypesMode(constraintypes.ENABLED)
        dest_folder.setLocallyAllowedTypes(['Folder',
'AuthoringPublishedDocument', 'File', 'Image', 'Document'])
        dest_folder.setImmediatelyAddableTypes(['Folder',
'AuthoringPublishedDocument', 'File', 'Image', 'Document'])

Creating a new AuthoringPublishedDocument instance inside this folder fails
badly:

Traceback (innermost last):
  Module ZPublisher.Publish, line 127, in publish
  Module ZPublisher.mapply, line 77, in mapply
  Module ZPublisher.Publish, line 47, in call_object
  Module zopyx.authoring.browser.conversionsfolder, line 228, in
generate_html_pdf
  Module Products.ATContentTypes.lib.constraintypes, line 261, in
invokeFactory
Unauthorized: Disallowed subobject type: AuthoringPublishedDocument

getAllowedContentTypes() for this particular folder returns only the types
of standard Plone but not my own type? Why this?

Andreas

>
/home/ajung/.buildout/eggs/Products.ATContentTypes-2.0.7-py2.6.egg/Products/ATContentTypes/lib/constraintypes.py(260)invokeFactory()
-> if not type_name in [fti.getId() for fti in self.allowedContentTypes()]:
(Pdb) print self.allowedContentTypes()
[<DynamicViewTypeInformation at /Plone/portal_types/Document>,
<DynamicViewTypeInformation at /Plone/portal_types/File>,
<DynamicViewTypeInformation at /Plone/portal_types/Folder>,
<DynamicViewTypeInformation at /Plone/portal_types/Image>]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.plone.org/pipermail/plone-product-developers/attachments/20110228/9d1b9985/attachment-0002.html>


More information about the Product-Developers mailing list