[Zope] Migration pains going to Zope 2.8

Dieter Maurer dieter at handshake.de
Wed Aug 24 14:36:37 EDT 2005


Richard Jones wrote at 2005-8-24 16:11 +1000:
>I can't instantiate out Product, which is a bit of a hurdle :)
>
>Our Product's registration looks like this (this function is invoked from the 
>Product's __init__.py):
>
>def initialize(context):
>    ''' Register the CGPublisher class '''
>    context.registerClass(
>        CGPublisher,
>        permission=Perm.ADD_CGPUBLISHERS,
>        constructors = (addCGPublisherForm, addCGPublisher, addValues,
>            getMode),
>        icon='www/CGPublisher.gif',
>        visibility='Global',
>        )
>
>Unfortunately, the addCGPublisherForm template can't access the "addValues" 
>function. The specific error I get is:
>
> Error Type: Unauthorized
> Error Value: The container has no security assertions. Access to 'addValues'
>  of (App.ProductContext.__FactoryDispatcher__ object at 0xb61d30cc) denied.

Maybe, you do not honor the following requirement
(documented in "App.ProductContext.ProductContext.registerClass"):

        constructors -- A list of constructor methods
          A method can me a callable object with a __name__
          attribute giving the name the method should have in the
          product, or the method may be a tuple consisting of a
          name and a callable object.  The method must be picklable.

          The first method will be used as the initial method called
          when creating an object.

Does your "addValue" have a "__name__" attribute with value "addValue"?

If so, you may want to analyse the "FactoryDispatcher" mentioned
above.

You get it (in an interactive interpreter) via

    app.manage_addProduct[<your Product>]

In its class, you should find your contructors as
well as permission attributes of the form "<constructor_name>__roles__".

Apparently, "addValues__roles__" is missing (for whatever reason).

-- 
Dieter


More information about the Zope mailing list