Re: [Zope-dev] Folderish objects and multiple inheritance
Hmmm I can override inheritance in a simple class... I guess theres something in Zope thats annoying this: class A: var = 'A' def test(self): return self.var class B: var = 'B' def test(self): return self.var class C(B, A): var = 'C' def test(self): return A.var c = C() print c.test() OUTPUT>> A ----- Original Message ----- From: "Andy McKay" <andym@ActiveState.com> To: <zope-dev@zope.org> Sent: Tuesday, September 05, 2000 11:35 AM Subject: [Zope-dev] Folderish objects and multiple inheritance
Hi there,
Ok so I have a class that has multiple inheritance. My main class (A) works fine, but I wanted to add in folderish properties. The problem is the order of multiple inheritance and viewing folder objects. When you view a folder from you call index_html and this gives a content list.
By inheriting this way:
class B(A, Folder):
I have kept all my A methods. However viewing it does not produce the content list since its overwritten by A. Of course inheriting:
class B(Folder, A):
Does work for that, but breaks all my other methods.
Solutions:
Well I tried defining a tab - view_folder which was something along the line of:
def view_folder(self, client=None, REQUEST={}): ''' doc string ''' return Folder(self, client, REQUEST)
But get an attribute error on manage_tabs.
Any ideas?
Thanks.
-- Andy McKay, Developer. ActiveState.
_______________________________________________ Zope-Dev maillist - Zope-Dev@zope.org http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Darn sorry wrong alias. ----- Original Message ----- From: "Andy McKay" <andym@ActiveState.com> To: <zope@zope.org> Sent: Tuesday, September 05, 2000 2:13 PM Subject: [Zope] Re: [Zope-dev] Folderish objects and multiple inheritance
Hmmm I can override inheritance in a simple class... I guess theres something in Zope thats annoying this:
class A: var = 'A'
def test(self): return self.var
class B: var = 'B'
def test(self): return self.var
class C(B, A): var = 'C'
def test(self): return A.var
c = C() print c.test()
OUTPUT>> A
----- Original Message ----- From: "Andy McKay" <andym@ActiveState.com> To: <zope-dev@zope.org> Sent: Tuesday, September 05, 2000 11:35 AM Subject: [Zope-dev] Folderish objects and multiple inheritance
Hi there,
Ok so I have a class that has multiple inheritance. My main class (A) works fine, but I wanted to add in folderish properties. The problem is the order of multiple inheritance and viewing folder objects. When you view a folder from you call index_html and this gives a content list.
By inheriting this way:
class B(A, Folder):
I have kept all my A methods. However viewing it does not produce the content list since its overwritten by A. Of course inheriting:
class B(Folder, A):
Does work for that, but breaks all my other methods.
Solutions:
Well I tried defining a tab - view_folder which was something along the line of:
def view_folder(self, client=None, REQUEST={}): ''' doc string ''' return Folder(self, client, REQUEST)
But get an attribute error on manage_tabs.
Any ideas?
Thanks.
-- Andy McKay, Developer. ActiveState.
_______________________________________________ Zope-Dev maillist - Zope-Dev@zope.org http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
_______________________________________________ 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 )
participants (1)
-
Andy McKay