Re: [Zope-dev] Dataskin Zclass + Folder subclassing problem
Hi Jean, You might get more feedback from the ZPatterns list on something like this. My gut reaction is that subclassing in python 2.1/1.5 traverses the classes to find methods in a way that makes the *order* of classes very important. IIUC Python 2.2 has a much more sophisticated attribute searching scheme, so that this will be easier to get right.. but so far Zope and 2.2 don't mix so well. You are no doubt getting the wrong class/attributes when you call objectIds etc. Can you try making ZClass1 a simple class and ZClass2 subclassing from DataSkin, Folder and *then* ZClass1? good luck! -steve On Tuesday, November 27, 2001, at 12:36 PM, Jean Lagarde wrote: Hi all, A ZClass inheriting from both DataSkin and Folder seems to work as expected (so much has been discussed in other messages, at least with ObjectManager). However, instead of inheriting directly from DataSkin, I want to inherit from another Zclass which is itself based on DataSkin, i.e. (not showing Zobjects): DataSkin ZClass1Folder | \ / | \ / v v v ZClass1ZClass2 After its creation, the new Zclass ZClass2 seems to have some management issues: - The views are initialized to those of ZClass1; no big deal, for now, I just added a new view tab named Contents for manage_main - When I create an instance of ZClass2 (in a Folder w/Customizer Support), the instance does show its Contents tab, but it does not quite know it's folderish: - It does not show in the left pane of the ZMI - If I add an object from the contents tab interface of the instance, say a dtml method, it adds OK, but does not show in the contents tab (the contents view is always empty no matter what I add) - The objects I added are there; I can traverse to them and their management interfaces, and I have also checked the ZODB directly using the wonderful pyTree.py. I'm afraid that I know just enough about Zope to be dangerous ;-) I basically just have the time to learn about the stuff that I need to get the job done, and I'm sure that the current version of what I'm working on will need some refactoring later on. So I have two questions: 1) Anybody can think of a quick fix to get the folderish behavior working as it should? 2) In its current state (if there is no quick fix), ZClass2 seems usable enough for my needs; I just need to add a couple of objects for each instance, and I can reach their management screens through explicit traversal. So I'm tempted to plug along and keep on experimenting with that setup for now. Any other more important consequences that I'm missing that should have me fix this more adequately before I proceed? Cheers, Jean ___ 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] Dataskin Zclass + Folder subclassing problem
Thanks Steve, No doubt that is probably what is happening. Sadly, I need ZClass1 to be a dataskin. I could always copy over the few properties and methods shared by ZClass1 and ZCLass2 to ZCLass2 and inherit only from DataSkin and Folder; not the nicest, but that would work for now. My approach to access the contained objects directly (and not attempt to list them) seems to work for now as well. If I find the time, I will investigate this further to see what is happening exactly. Cheers, Jean -Original Message- From: Steve Spicklemire [mailto:[EMAIL PROTECTED]] Sent: Friday, November 30, 2001 03:13 Hi Jean, You might get more feedback from the ZPatterns list on something like this. My gut reaction is that subclassing in python 2.1/1.5 traverses the classes to find methods in a way that makes the *order* of classes very important. IIUC Python 2.2 has a much more sophisticated attribute searching scheme, so that this will be easier to get right.. but so far Zope and 2.2 don't mix so well. You are no doubt getting the wrong class/attributes when you call objectIds etc. Can you try making ZClass1 a simple class and ZClass2 subclassing from DataSkin, Folder and *then* ZClass1? good luck! -steve On Tuesday, November 27, 2001, at 12:36 PM, Jean Lagarde wrote: Hi all, A ZClass inheriting from both DataSkin and Folder seems to work as expected (so much has been discussed in other messages, at least with ObjectManager). However, instead of inheriting directly from DataSkin, I want to inherit from another Zclass which is itself based on DataSkin, i.e. (not showing Zobjects): DataSkin ZClass1Folder | \ / | \ / v v v ZClass1ZClass2 After its creation, the new Zclass ZClass2 seems to have some management issues: - The views are initialized to those of ZClass1; no big deal, for now, I just added a new view tab named Contents for manage_main - When I create an instance of ZClass2 (in a Folder w/Customizer Support), the instance does show its Contents tab, but it does not quite know it's folderish: - It does not show in the left pane of the ZMI - If I add an object from the contents tab interface of the instance, say a dtml method, it adds OK, but does not show in the contents tab (the contents view is always empty no matter what I add) - The objects I added are there; I can traverse to them and their management interfaces, and I have also checked the ZODB directly using the wonderful pyTree.py. I'm afraid that I know just enough about Zope to be dangerous ;-) I basically just have the time to learn about the stuff that I need to get the job done, and I'm sure that the current version of what I'm working on will need some refactoring later on. So I have two questions: 1) Anybody can think of a quick fix to get the folderish behavior working as it should? 2) In its current state (if there is no quick fix), ZClass2 seems usable enough for my needs; I just need to add a couple of objects for each instance, and I can reach their management screens through explicit traversal. So I'm tempted to plug along and keep on experimenting with that setup for now. Any other more important consequences that I'm missing that should have me fix this more adequately before I proceed? Cheers, Jean ___ 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] Dataskin Zclass + Folder subclassing problem
Jean Lagarde wrote: Thanks Steve, No doubt that is probably what is happening. Sadly, I need ZClass1 to be a dataskin. Make both ZClass1 and ZClass2 derive from Dataskin before anything else. It will do no harm that DataSkin is derived from twice in one class. -- Steve Alexander ___ 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] Dataskin Zclass + Folder subclassing problem
It's Steves to the rescue today! Using the order (DataSkin, Folder, ZClass1) seems to have done the trick! Thanks! I would have thought about subclassing DataSkin again, eventually ;-) I had tried to inherit from (Folder, ZClass1) rather than (ZClass1, Folder), but that order was giving me a _v_dm_ key error; that should have clued me into the right direction. Jean From: Steve Alexander [mailto:[EMAIL PROTECTED]] Sent: Friday, November 30, 2001 09:10 Jean Lagarde wrote: Thanks Steve, No doubt that is probably what is happening. Sadly, I need ZClass1 to be a dataskin. Make both ZClass1 and ZClass2 derive from Dataskin before anything else. It will do no harm that DataSkin is derived from twice in one class. -- Steve Alexander ___ 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 )