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
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
Thanks! I have a new question that may (?) be the same old one in a different form: The idea is to have two ZClasses, say Foo and Bar. Bar is a nested class of Foo. The Foo object should be able create n instances of the Bar objects and the Bar object should also be able to create n instances of other Bar objects. Creating Bar in Foo is no problem. Creating Bar in Bar is a problem since Zope won't display the interface for adding objects. Adding new Bars is selected in the permissions menu/tab for both ZClasses. Foo inherits ZClass:ObjectManager and Bar is a "child" of Foo. I've tried grovelling around the mailing-lists and seen discussions about inheriting OFS:Folder and/or issues of folderish-ness. I tried making Bar inherit OFS:Folder, but then I just got a popup menu that lets me create Foo, but not Bar. I'm confused and starting to feel like a bit of a dumb-ass. Can someone point me in the right direction? Thanks, On Fri, 10 Nov 2000, Jim Washington wrote:
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
participants (2)
-
Aaron Straup Cope -
Jim Washington