Re: [Zope-dev] Folderish objects and multiple inheritance
Well if anybody is interested I did solve this but instead of trying to inherit A, Folder and then fix the folderish methods broken I did Folder, A and then overrode class A methods I wanted. - Original Message - From: "Andy McKay" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, September 05, 2000 2:20 PM Subject: Re: [Zope-dev] Folderish objects and multiple inheritance > > - Original Message - > From: "Andy McKay" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > 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" <[EMAIL PROTECTED]> > > To: <[EMAIL PROTECTED]> > > 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 - [EMAIL PROTECTED] > > > 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 - [EMAIL PROTECTED] > > 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-Dev maillist - [EMAIL PROTECTED] > 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-Dev maillist - [EMAIL PROTECTED] 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 )
Re: [Zope-dev] Folderish objects and multiple inheritance
- Original Message - From: "Andy McKay" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> 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" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > 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 - [EMAIL PROTECTED] > > 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 - [EMAIL PROTECTED] > 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-Dev maillist - [EMAIL PROTECTED] 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-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 - [EMAIL PROTECTED] 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 )