[Zope] Creating products

Dustin Mitchell dustin at ywlcs.org
Sun Aug 17 14:29:05 EDT 2003


On Sun, Aug 17, 2003 at 02:15:41PM -0400, Paul Winkler wrote:
> 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

Of course:

def initialize(registrar):
  ...
  registrar.registerClass(
      VolunteerUserFolder,
      permission = 'Add Volunteer Objects',
      icon = "icons/vuf.png",
      constructors = (manage_addVolunteerUserFolder,),
      )

(same effect with classes which have two constructors---(manage_addX,
manage_addXForm) )

I'm still not clear where the attributes for

  context.manage_addProduct['Volunteer']

come from -- if I added .foo() to the end of that, where would Zope
look for 'foo'?

Thanks for the thoughts so far..

Dustin

-- 

  Dustin Mitchell
  dustin at ywlcs.org/djmitche at alumni.uchicago.edu
  http://people.cs.uchicago.edu/~dustin/
  PGP Key: http://people.cs.uchicago.edu/~dustin/pubkey.txt                                                                                  



More information about the Zope mailing list