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

Aaron Straup Cope asc@vineyard.net
Fri, 10 Nov 2000 14:56:57 -0500 (EST)


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