[Zope] ZClasses & inheriting property(sheets) : yes/no?

Jim Washington jwashin@vt.edu
Fri, 10 Nov 2000 15:31:22 -0500


Hi, Aaron

Yes.

If your parent ZClass is constructed properly, you should be able to add
the parent class's management tabs by setting a "view". On the "Views"
tab, look in the Method list for
propertysheets/[ParentClassPropertySheetName]/manage.  The properties on
that sheet are accessible just like any of the child class's properties.

-- Jim Washington

Aaron Straup Cope wrote:
> 
> Hi,
> 
> If I create a ZClass that inherits another ZClass, do I also inherit the
> latter's properties/propertysheet? From what I've read so far, I thought
> the answer was yes but I can't seem to figure out how to *get* at them.
> 
> I created a ZClass called "Foo" that inherits a ZClass named "Meta". Meta
> had two properties : author and title but neither appear to be set when
> I create a new Foo object.
> 
> I banged out something in plain-old Python (see below) since I was pretty
> sure this was the kind of thing Python was so good for (I am normally a
> Perl weenie....shhhhh :-) and everything worked fine.
> 
> I've been looking around the docs and the how-to's but nothing seems to
> discuss the idea of inheriting properties (?) across ZClasses. Is it
> possible?
> 
> Thanks,
> 
> class Meta:
>    def __init__(self,title,author,timestamp,keywords,body,public,display):
>        self.title     = title
>        self.author    = author
>        self.timestamp = timestamp
>        self.keywords  = keywords
>        self.body      = body
>        self.display   = display
>        self.public    = public
> 
> ****
> 
> from Meta import Meta
> class Library(Meta):
>       def
> __init__(self,title,author,timestamp,keywords,body,public,display,foo,bar=""):
> 
> Meta.__init__(self,title,author,timestamp,keywords,body,public,display)
>           self.foo = foo
>           self.bar = bar
> 
> ****
> 
> from Meta import Meta
> class LibraryClass(Meta):
>       def __init__(self,title,author,timestamp,keywords,body,public,display):
>     Meta.__init__(self,title,author,timestamp,keywords,body,public,display)
> 
> ***
> 
> # from yadda yadda import ...
> lib      = Library("budwork","bud","now",["foo","bar"],"bobdy",1,0,"foopybird")
> libclass = LibraryClass("classwork","bud","now",["foo","bar"],"bobdy",1,0)
> 
> print "Class Title is " + lib.title
> print "LibClass Title is " + libclass.title
> 
> _______________________________________________
> 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 )

-- 

Jim Washington
Center for Assessment, Evaluation and Educational Programming
Department of Teaching and Learning, Virginia Tech