[Zope] Creating products

Paul Winkler pw_lists at slinkp.com
Sun Aug 17 15:15:41 EDT 2003


On Sun, Aug 17, 2003 at 01:03:40PM -0500, Dustin Mitchell wrote:
> Nope, product (which is already quite well along) is installed
> correctly, adding from the ZMI works just fine, etc.
> 
> Inside the manage_addVolunteerSite :
> 
>   ...
>   volunteersite.manage_addProduct['Volunteer'].manage_addVolunteerUserFolder()
>   ...
> 
> causes:
> 
>   Error Type: AttributeError
>   Error Value: _getProducts
(snip)

> However, this works:
> 
>   acl_users = VolunteerUserFolder()
>   volunteersite._setObject('acl_users', acl_users);

I would guess that the problem is Dylan's second possible diagnosis:

> > 2. Your classes aren't registered correctly

In your __init__.py should be an initialize() function that
calls context.registerClass for *each* class class that you want to
be an addable Product. Have you done this?  E.g. from Max M's
Minimal Product howto:

import minimal

def initialize(context): 
    """Initialize the minimal product.
    This makes the object apear in the product list"""
    context.registerClass(
        minimal.minimal,
        constructors = ( 
            minimal.manage_addMinimal, # This is called when 
                                       # someone adds the product
	    )
        )


-- 

Paul Winkler
http://www.slinkp.com
Look! Up in the sky! It's MARMITE INDEFATIGABLE SALESMAN MAN!
(random hero from isometric.spaceninja.com)



More information about the Zope mailing list