[Zope] Product inhetitance question

Daniel Rusch drusch@globalcrossing.com
Thu, 17 Aug 2000 13:53:40 -0500


This worked for me, what a hack

  _ properties=[]
    for i in range(0,len(A._properties)):
        _properties.append(A._properties[i])

    _properties.append({'id':'RenderStandardHeader', 'type':'int','mode':'w'})
    tuple(_properties)


Andy McKay wrote:

> Hmm.... i just tested it in Zope and it worked fine for me.
> --
>      Andy McKay, Developer, ActiveState
>      http://www.ActiveState.com
>      Programming for the People
>
> ----- Original Message -----
> From: "Daniel Rusch" <drusch@globalcrossing.com>
> To: "Andy McKay" <AndyM@ActiveState.com>
> Sent: Thursday, August 17, 2000 11:36 AM
> Subject: Re: [Zope] Product inhetitance question
>
> > Great minds think a like or fools never differ.
> >
> > I tried this to but I get an error:
> >     TypeError: bad operand type(s) for +
> >
> > Dan
> >
> > Andy McKay wrote:
> >
> > > I just had the exact same problem and I solved this morning by:
> > >
> > > class A:
> > >     _properties = ( {...} )
> > >
> > > class B(A):
> > >     _properties = ( { new stuff... } )
> > >     _properties = _properties + A._properties
> > >
> > > This is tested in a quick script, but not fully in the products yet. So
> this
> > > will make class B have a properties dict that includes all of A, so you
> > > shouldnt need to edit manage_edit... in theory!
> > >
> > > --
> > >      Andy McKay, Developer, ActiveState
> > >      http://www.ActiveState.com
> > >      Programming for the People
> > >
> > > ----- Original Message -----
> > > From: "Daniel Rusch" <drusch@globalcrossing.com>
> > > To: "Andy McKay" <AndyM@activestate.com>
> > > Sent: Thursday, August 17, 2000 9:40 AM
> > > Subject: Re: [Zope] Product inhetitance question
> > >
> > > > Sorry to keep bothering you, but I'm on the threshold of success
> > > >
> > > > my B class has an extra property, therefore B's manage_edit needs to
> > > address
> > > > this. In C++ I could override the base class's manage_edit do the B
> stuff
> > > and
> > > > then call the base class's manage_edit, can this be done in python???
> > > >
> > > > Dan
> > > >
> > > > Andy McKay wrote:
> > > >
> > > > > Well by inheritance B has all the methods, properties etc you have
> in A.
> > > So
> > > > > the answer is yes, if A has the foobar method then B will have a
> foobar
> > > > > method.
> > > > >
> > > > > Or do I misunderstand your question?
> > > > > --
> > > > >      Andy McKay, Developer, ActiveState
> > > > >      http://www.ActiveState.com
> > > > >      Programming for the People
> > > > >
> > > > > ----- Original Message -----
> > > > > From: "Daniel Rusch" <drusch@globalcrossing.com>
> > > > > To: <zope@zope.org>
> > > > > Sent: Thursday, August 17, 2000 8:42 AM
> > > > > Subject: [Zope] Product inhetitance question
> > > > >
> > > > > > Hey all,
> > > > > >
> > > > > > Say I have a fully functional (and more importantly, working)
> Product
> > > > > > will call A.
> > > > > >
> > > > > > I want to extend this Product's capabilities so I wish to derive
> > > another
> > > > > > class from it, call it B.
> > > > > >
> > > > > > No problem,
> > > > > >
> > > > > > class B(A):
> > > > > >     .........
> > > > > >
> > > > > >
> > > > > > The question is, (I think the answer is no) is there a way to
> inherit
> > > > > > (i.e. reuse common code and extend it) the manage_Add function and
> the
> > > > > > dtml files from A???
> > > > > >
> > > > > > Thanks,
> > > > > >
> > > > > > DR
> > > > > >
> > > > > >
> > > > > >
> > > > > > _______________________________________________
> > > > > > Zope maillist  -  Zope@zope.org
> > > > > > http://lists.zope.org/mailman/listinfo/zope
> > > > > > **   No cross posts or HTML encoding!  **
> > > > > > (Related lists -
> > > > > >  http://lists.zope.org/mailman/listinfo/zope-announce
> > > > > >  http://lists.zope.org/mailman/listinfo/zope-dev )
> > > > > >
> > > > >
> > > > > _______________________________________________
> > > > > Zope maillist  -  Zope@zope.org
> > > > > http://lists.zope.org/mailman/listinfo/zope
> > > > > **   No cross posts or HTML encoding!  **
> > > > > (Related lists -
> > > > >  http://lists.zope.org/mailman/listinfo/zope-announce
> > > > >  http://lists.zope.org/mailman/listinfo/zope-dev )
> > > >
> >