[Zope-CMF] Should object paste check FTI?

Wichert Akkerman wichert at wiggy.net
Fri Jan 11 13:20:38 UTC 2013


PortalFolderBase overrides _verifyObjectPaste to add some extra checks on top of OFS's CopyContainer to check if content may be pasted: it copies the permission checking (why doesn't it call the base class for that?) and adds code to check for allowed types. There is one check missing there that is checked when creating new object: the FTI may block creation of new content as well through its isConstructionAllowed method. Is there any reason _verifyObjectPaste check this as well? This should be simple to do:

    portal_type = getattr(aq_base(obj), 'portal_type', None)
    if portal_type:
        fti = queryUtility(ITypeInformation, name=portal_type)
        if fti is not None and not fti.isConstructionAllowed(self):
            raise ValueError('You can not add the copied content here.')

This allows for much more control over content pasting.

Wichert.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.zope.org/pipermail/zope-cmf/attachments/20130111/20cbe6d6/attachment.html>


More information about the Zope-CMF mailing list