Re: [Zope-dev] Re: New-style ExtensionClasses (Zope 2.8) -- MRO issue
On Mon, 2003-11-24 at 12:03, Christian Heimes wrote: Sidnei da Silva wrote: I'm going to fix those (after my english class) and then try something harder ;) Here is more stuff: import mrohell base = mrohell.step1() mrohell.step2(base, mroonly=True) Couldn't get mro for Products.Archetypes.BaseBTreeFolder.BaseBTreeFolder Couldn't get mro for Products.Archetypes.BaseFolder.BaseFolder Couldn't get mro for Products.Archetypes.OrderedBaseFolder.OrderedBaseFolder Couldn't get mro for Products.GroupUserFolder.GroupUserFolder.GroupUserFolder Couldn't get mro for Products.CMFPlone.PloneFolder.BasePloneFolder Couldn't get mro for Products.CMFPlone.LargePloneFolder.LargePloneFolder Couldn't get mro for Products.Archetypes.BaseFolder.BaseFolderMixin Couldn't get mro for Products.CMFDefault.SkinnedFolder.SkinnedFolder Couldn't get mro for Products.CMFPlone.PloneFolder.PloneFolder Couldn't get mro for Products.Archetypes.ArchetypeTool.ArchetypeTool Couldn't get mro for Products.CMFFormController.Script.FSPythonScript Couldn't get mro for Products.CMFFormController.FSControllerValidator.FSControllerValidator Couldn't get mro for Products.CMFCore.FSPythonScript.FSPythonScript Couldn't get mro for Products.CMFFormController.FSControllerPythonScript.FSControllerPythonScript Couldn't get mro for Products.CMFCore.FSPageTemplate.FSPageTemplate Couldn't get mro for Products.CMFFormController.FSControllerPageTemplate.FSControllerPageTemplate Couldn't get mro for Products.CMFPlone.PropertiesTool.PropertiesTool Couldn't get mro for Products.CMFCore.FSZSQLMethod.FSZSQLMethod Couldn't get mro for Products.CMFPlone.FactoryTool.TempFolder Couldn't get mro for Products.Archetypes.OrderedBaseFolder.OrderedFolder Couldn't get mro for Products.Archetypes.examples.SimpleFolder.SimpleFolder 526 21 210 It seems that there are only several classes that cause problems: Products.CMFDefault.SkinnedFolder.SkinnedFolder Products.Archetypes.BaseFolder.BaseFolder Products.CMFCore.FS* Products.Archetypes.BaseFolder.BaseFolderMixin AFAIK most of the other classes with mro problems are just subclasses of these classes above. Jim made checkins to deal with the CMF-related MRO problems, on his 'mro-advanture-branch':: === CMF/CMFDefault/SkinnedFolder.py 1.15 = 1.15.6.1 === --- CMF/CMFDefault/SkinnedFolder.py:1.15Sat Jun 28 12:31:21 2003 +++ CMF/CMFDefault/SkinnedFolder.py Fri Oct 31 14:24:19 2003 @@ -61,8 +61,7 @@ , ) - -class SkinnedFolder(CMFCatalogAware, PortalFolder): +class SkinnedFolder(PortalFolder): meta_type = 'Skinned Folder' @@ -70,6 +69,10 @@ security = ClassSecurityInfo() manage_options = PortalFolder.manage_options + +indexObject = CMFCatalogAware.indexObject +unindexObject = CMFCatalogAware.unindexObject +reindexObject = CMFCatalogAware.reindexObject def __call__(self): ''' === CMF/CMFCore/FSObject.py 1.15 = 1.15.2.1 === --- CMF/CMFCore/FSObject.py:1.15Fri Sep 12 20:46:40 2003 +++ CMF/CMFCore/FSObject.py Fri Oct 31 14:24:18 2003 @@ -18,7 +18,7 @@ from string import split from os import path, stat -import Acquisition, Globals +import Acquisition, Globals, ExtensionClass from AccessControl import ClassSecurityInfo from OFS.SimpleItem import Item from DateTime import DateTime @@ -31,7 +31,7 @@ from OFS.Cache import Cacheable -class FSObject(Acquisition.Implicit, Item, Cacheable): +class FSObject(Item, Cacheable, Acquisition.Implicit, ExtensionClass.Base): FSObject is a base class for all filesystem based look-alikes. Subclasses of this class mimic ZODB based objects like Image and I imagine making similar small changes to Archetypes won't be hard. Tres. -- === Tres Seaver[EMAIL PROTECTED] Zope Corporation Zope Dealers http://www.zope.com ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] Re: New-style ExtensionClasses (Zope 2.8) -- MRO issue
Note that this is moot, as I've decided to use a backward-compatible mro. That is, new-style extension classes will use an mro that is backward compatible with old-style extension classes. They do *not* use the same mro algorithm as new-style classes. Jim Tres Seaver wrote: On Mon, 2003-11-24 at 12:03, Christian Heimes wrote: Sidnei da Silva wrote: I'm going to fix those (after my english class) and then try something harder ;) Here is more stuff: import mrohell base = mrohell.step1() mrohell.step2(base, mroonly=True) Couldn't get mro for Products.Archetypes.BaseBTreeFolder.BaseBTreeFolder Couldn't get mro for Products.Archetypes.BaseFolder.BaseFolder Couldn't get mro for Products.Archetypes.OrderedBaseFolder.OrderedBaseFolder Couldn't get mro for Products.GroupUserFolder.GroupUserFolder.GroupUserFolder Couldn't get mro for Products.CMFPlone.PloneFolder.BasePloneFolder Couldn't get mro for Products.CMFPlone.LargePloneFolder.LargePloneFolder Couldn't get mro for Products.Archetypes.BaseFolder.BaseFolderMixin Couldn't get mro for Products.CMFDefault.SkinnedFolder.SkinnedFolder Couldn't get mro for Products.CMFPlone.PloneFolder.PloneFolder Couldn't get mro for Products.Archetypes.ArchetypeTool.ArchetypeTool Couldn't get mro for Products.CMFFormController.Script.FSPythonScript Couldn't get mro for Products.CMFFormController.FSControllerValidator.FSControllerValidator Couldn't get mro for Products.CMFCore.FSPythonScript.FSPythonScript Couldn't get mro for Products.CMFFormController.FSControllerPythonScript.FSControllerPythonScript Couldn't get mro for Products.CMFCore.FSPageTemplate.FSPageTemplate Couldn't get mro for Products.CMFFormController.FSControllerPageTemplate.FSControllerPageTemplate Couldn't get mro for Products.CMFPlone.PropertiesTool.PropertiesTool Couldn't get mro for Products.CMFCore.FSZSQLMethod.FSZSQLMethod Couldn't get mro for Products.CMFPlone.FactoryTool.TempFolder Couldn't get mro for Products.Archetypes.OrderedBaseFolder.OrderedFolder Couldn't get mro for Products.Archetypes.examples.SimpleFolder.SimpleFolder 526 21 210 It seems that there are only several classes that cause problems: Products.CMFDefault.SkinnedFolder.SkinnedFolder Products.Archetypes.BaseFolder.BaseFolder Products.CMFCore.FS* Products.Archetypes.BaseFolder.BaseFolderMixin AFAIK most of the other classes with mro problems are just subclasses of these classes above. Jim made checkins to deal with the CMF-related MRO problems, on his 'mro-advanture-branch':: === CMF/CMFDefault/SkinnedFolder.py 1.15 = 1.15.6.1 === --- CMF/CMFDefault/SkinnedFolder.py:1.15Sat Jun 28 12:31:21 2003 +++ CMF/CMFDefault/SkinnedFolder.py Fri Oct 31 14:24:19 2003 @@ -61,8 +61,7 @@ , ) - -class SkinnedFolder(CMFCatalogAware, PortalFolder): +class SkinnedFolder(PortalFolder): meta_type = 'Skinned Folder' @@ -70,6 +69,10 @@ security = ClassSecurityInfo() manage_options = PortalFolder.manage_options + +indexObject = CMFCatalogAware.indexObject +unindexObject = CMFCatalogAware.unindexObject +reindexObject = CMFCatalogAware.reindexObject def __call__(self): ''' === CMF/CMFCore/FSObject.py 1.15 = 1.15.2.1 === --- CMF/CMFCore/FSObject.py:1.15Fri Sep 12 20:46:40 2003 +++ CMF/CMFCore/FSObject.py Fri Oct 31 14:24:18 2003 @@ -18,7 +18,7 @@ from string import split from os import path, stat -import Acquisition, Globals +import Acquisition, Globals, ExtensionClass from AccessControl import ClassSecurityInfo from OFS.SimpleItem import Item from DateTime import DateTime @@ -31,7 +31,7 @@ from OFS.Cache import Cacheable -class FSObject(Acquisition.Implicit, Item, Cacheable): +class FSObject(Item, Cacheable, Acquisition.Implicit, ExtensionClass.Base): FSObject is a base class for all filesystem based look-alikes. Subclasses of this class mimic ZODB based objects like Image and I imagine making similar small changes to Archetypes won't be hard. Tres. -- Jim Fulton mailto:[EMAIL PROTECTED] Python Powered! CTO (540) 361-1714http://www.python.org Zope Corporation http://www.zope.com http://www.zope.org ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] Re: New-style ExtensionClasses (Zope 2.8) -- MRO issue
On Mon, 2003-11-24 at 13:22, Sidnei da Silva wrote: I think it was decided for the non-mro approach, though no one stated it clearly. If it was, they sure didn't. A summary of the opinions that lead to the decision would be nice. Even if it's decided, it wouldn't hurt to fix the inheritance problems in CMF. One of the key properties of C3 is local order is honored. If a class A has two base classes B and C, then a method defined in B and C (perhaps via their base classes) will be found in B first. This matches the way I think about inheritance, but not the way the old algorithm works. You may be able to change the inheritance hierarchy so that C3 and classic MROs both have the same results. Then programmers will be able to understand the code :-). Jeremy ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] Re: New-style ExtensionClasses (Zope 2.8) -- MRO issue
On Mon, 24 Nov 2003 14:06:07 -0500 Jeremy Hylton [EMAIL PROTECTED] wrote: [snip] Then programmers will be able to understand the code :-). Very interesting conclusion... I might argue that it would be a premature optimization however ;^) -Casey ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] Re: New-style ExtensionClasses (Zope 2.8) -- MRO issue
On Fri, Oct 31, 2003 at 03:08:34PM -0500, Jim Fulton wrote: | Sidnei da Silva wrote: | On Fri, Oct 31, 2003 at 02:39:28PM -0500, Jim Fulton wrote: | | I've checked the results of my work into the mro-advanture-branch (waa, | | I wish I cud spell) branch. | | | | You might find it entertaining to check out Zope on this branch: | | | | cvs co -rmro-advanture-branch Zope | | | | (and build it) (Note, Python2.3 is required.) | | | | Install your favorite products (CMF makes a nice example) | | and then use the functions in the included mrohell module to | | find out if you have a problem: | | | | cd Zope | | bin/zopectl debug | |import mrohell | |base = merohell.step1() | |mrohell.step2(base, mroonly=True) ERmm am I missing something? [EMAIL PROTECTED]:~/src/zope/2_7-mro$ find . -name mrohell [EMAIL PROTECTED]:~/src/zope/2_7-mro$ cat CVS/Tag Tmro-advanture-branch [EMAIL PROTECTED]:~/src/instance/mro]$ ./bin/zopectl debug Starting debugger (the name app is bound to the top-level Zope object) import mrohell Traceback (most recent call last): File stdin, line 1, in ? ImportError: No module named mrohell -- Sidnei da Silva [EMAIL PROTECTED] dreamcatching :: making your dreams come true http://awkly.org That does not compute. ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] Re: New-style ExtensionClasses (Zope 2.8) -- MRO issue
Not bad. On a 'stock' plone installation, i've got these results: [EMAIL PROTECTED]:~/src/instance/mro$ ./bin/zopectl debug Starting debugger (the name app is bound to the top-level Zope object) import mrohell base = mrohell.step1() mrohell.step2(base, mroonly=True) Couldn't get mro for Products.GroupUserFolder.GroupUserFolder.GroupUserFolder Couldn't get mro for Products.CMFFormController.Script.FSPythonScript Couldn't get mro for Products.CMFFormController.FSControllerValidator.FSControllerValidator Couldn't get mro for Products.CMFFormController.FSControllerPythonScript.FSControllerPythonScript Couldn't get mro for Products.CMFPlone.PropertiesTool.PropertiesTool 488 5 210 I'm going to fix those (after my english class) and then try something harder ;) -- Sidnei da Silva [EMAIL PROTECTED] dreamcatching :: making your dreams come true http://awkly.org A modem is a baudy house. ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] Re: New-style ExtensionClasses (Zope 2.8) -- MRO issue
Sorry, it was just on the wrong place. [EMAIL PROTECTED]:~/src/zope/2_7-mro$ find . -name *mroh* ./mrohell.py -- Sidnei da Silva [EMAIL PROTECTED] dreamcatching :: making your dreams come true http://awkly.org The steady state of disks is full. -- Ken Thompson ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] Re: New-style ExtensionClasses (Zope 2.8) -- MRO issue
On Sat, Nov 01, 2003 at 09:10:11AM -0200, Sidnei da Silva wrote: | Couldn't get mro for | Products.GroupUserFolder.GroupUserFolder.GroupUserFolder | Couldn't get mro for Products.CMFFormController.Script.FSPythonScript | Couldn't get mro for | Products.CMFFormController.FSControllerValidator.FSControllerValidator | Couldn't get mro for | Products.CMFFormController.FSControllerPythonScript.FSControllerPythonScript | Couldn't get mro for Products.CMFPlone.PropertiesTool.PropertiesTool | 488 5 210 The ones in CMFPlone and CMFFormController seemed easy to fix, I haven't dived much into GroupUserFolder, as it's hieararchy seems very complex to me. I checked in the changes on separate branches of each product. In Plone I just changed Folder for ObjectManager, and in CMFFormController I separated the class into a mixin class with no bases, that is then mixed into FSPythonScript. The mrohell script is very nice, though I haven't really understood the output. I fixed those by trial and error :( []'s -- Sidnei da Silva [EMAIL PROTECTED] dreamcatching :: making your dreams come true http://awkly.org BYTE editors are people who separate the wheat from the chaff, and then carefully print the chaff. ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] Re: New-style ExtensionClasses (Zope 2.8) -- MRO issue
On Fri, Oct 31, 2003 at 02:39:28PM -0500, Jim Fulton wrote: | I've checked the results of my work into the mro-advanture-branch (waa, | I wish I cud spell) branch. | | You might find it entertaining to check out Zope on this branch: | | cvs co -rmro-advanture-branch Zope | | (and build it) (Note, Python2.3 is required.) | | Install your favorite products (CMF makes a nice example) | and then use the functions in the included mrohell module to | find out if you have a problem: | | cd Zope | bin/zopectl debug |import mrohell |base = merohell.step1() |mrohell.step2(base, mroonly=True) | | and see if you get any mro problems. If you do, see if you can | figure out how to fix them. Amazing! A perfect task for a saturday evening ;) -- Sidnei da Silva [EMAIL PROTECTED] dreamcatching :: making your dreams come true http://awkly.org This is an unauthorized cybernetic announcement. ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] Re: New-style ExtensionClasses (Zope 2.8) -- MRO issue
Sidnei da Silva wrote: On Fri, Oct 31, 2003 at 02:39:28PM -0500, Jim Fulton wrote: | I've checked the results of my work into the mro-advanture-branch (waa, | I wish I cud spell) branch. | | You might find it entertaining to check out Zope on this branch: | | cvs co -rmro-advanture-branch Zope | | (and build it) (Note, Python2.3 is required.) | | Install your favorite products (CMF makes a nice example) | and then use the functions in the included mrohell module to | find out if you have a problem: | | cd Zope | bin/zopectl debug |import mrohell |base = merohell.step1() |mrohell.step2(base, mroonly=True) | | and see if you get any mro problems. If you do, see if you can | figure out how to fix them. Amazing! A perfect task for a saturday evening ;) Actually, I was thinking it would be well suited to Halloween. Trick or treat! Jim -- Jim Fulton mailto:[EMAIL PROTECTED] Python Powered! CTO (540) 361-1714http://www.python.org Zope Corporation http://www.zope.com http://www.zope.org ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )