[Zope-CMF] Disallowed subobject type

Tres Seaver tseaver@zope.com
11 Oct 2002 08:34:45 -0400


On Fri, 2002-10-11 at 08:42, Pascal Samuzeau wrote:
> Hi,                                                                   
>                                                                       
> I have this error :                                                   
>                                                                       
> Type de l'erreur : ValueError                                         
> Valeur de l'erreur : Disallowed subobject type: Document              
>                                                                       
> Does anybody know about it ?

Obi-wan says, "Use the source, Luke!"

 [/opt/home/tseaver/projects/CMF]
 $ find . -name "*.py" | xargs grep Disallowed
 ./CMFCore/PortalFolder.py:                raise ValueError,\
    'Disallowed  subobject type: %s' % type_name

which takes us to PortalFolder's 'invokeFactory' method:

    def invokeFactory( self
                     , type_name
                     , id
                     , RESPONSE=None
                     , *args
                     , **kw
                     ):
        '''
        Invokes the portal_types tool.
        '''
        pt = getToolByName( self, 'portal_types' )
        myType = pt.getTypeInfo(self)

        if myType is not None:
            if not myType.allowType( type_name ):
                raise ValueError, 'Disallowed subobject type: %s'\
                   % type_name

        apply( pt.constructContent
             , (type_name, self, id, RESPONSE) + args
             , kw
             )

TypeInformation objects are allowed to filter the content types which
are addable within them, via the 'allowType' method;  out-of-the-box
FactoryTypeInformation handles this by checking the
'filter_content_types' and 'allowed_content_types' properties.

Tres.
-- 
===============================================================
Tres Seaver                                tseaver@zope.com
Zope Corporation      "Zope Dealers"       http://www.zope.com