hi! i have the following method defined in an extension class: def reInitClass(cls): """ docstring """ cls().reInit() reInitClass = classmethod(reInitClass) as one can see this method should call the parameter named "cls" and this way make an instance of cls and then call reInit() on this instance... i'd like to call this method in the __init__.py file of my product: def initialize(registrar): registrar.ViewContainer( ViewContainer, constructors = (addViewContainerForm, addViewContainerMethod) ) ViewContainer.reInitClass() starting zope with these files in place yields the following error message: File "/home/apis/zope-bliss01/Products/ViewContainer/__init__.py", line 10, in initialize ViewContainer.reInitClass() TypeError: 'classmethod' object is not callable wtf??? if a classmethod object is not callable, what is it for then? a simple python example with classmethod() did work of course - so am i trying something impossible in zope? thanks in advance for your replies... regards, juergen herrmann
Jürgen Herrmann wrote at 2005-2-28 15:38 +0100:
... i have the following method defined in an extension class: def reInitClass(cls): """ docstring """ cls().reInit() reInitClass = classmethod(reInitClass)
"classmethod" is a new style class concept (it is a descriptor).
... File "/home/apis/zope-bliss01/Products/ViewContainer/__init__.py", line 10, in initialize ViewContainer.reInitClass() TypeError: 'classmethod' object is not callable
Zope's ExtensionClass'es are still old style classes. This will change with Zope 2.8. You must wait until then... -- Dieter
Johan Carlsson wrote:
Dieter Maurer wrote:
Zope's ExtensionClass'es are still old style classes. This will change with Zope 2.8.
How about Zope3. Are ExtentionClasses use in Zope3?
I believe the new style classes Dieter refers to are used in Zope 3... Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk
Chris Withers wrote:
Johan Carlsson wrote:
Dieter Maurer wrote:
Zope's ExtensionClass'es are still old style classes. This will change with Zope 2.8.
How about Zope3. Are ExtentionClasses use in Zope3?
I believe the new style classes Dieter refers to are used in Zope 3...
What differences and/or similarities are there between new style classes and ExtentionClasses? For instance how does Acquisition work in Zope3/Zope2.8? Any docs I can (should) read? -- Johan Carlsson Tel: + 46 8 31 24 94 Colliberty Mob: + 46 70 558 25 24 Torsgatan 72 Email: johanc@easypublisher.com SE-113 37 STOCKHOLM
[ Johan Carlsson wrote:]
Chris Withers wrote:
Johan Carlsson wrote:
Dieter Maurer wrote:
Zope's ExtensionClass'es are still old style classes. This will change with Zope 2.8.
How about Zope3. Are ExtentionClasses use in Zope3?
I believe the new style classes Dieter refers to are used in Zope 3...
What differences and/or similarities are there between new style classes and ExtentionClasses?
For instance how does Acquisition work in Zope3/Zope2.8? Any docs I can (should) read?
hi all! here's what i've found out so far: zope 2.7.x is based on old style python classes. zope 2.8.x will be rewritten to use new style classes (did'nt have time to look at 2.8.0a1 yet, though) i know quite little about the actual differences in new/old style classes. btw: my initial problem with classmethod() is not related with new style classes at all. for the changes to extension classes in 2.8 i recommend reading the changelog for 2.8.0a1... regards, juergen herrmann _______________________________________________________________________
XLhost.de - eXperts in Linux hosting <<
Juergen Herrmann Weiherweg 10, 93051 Regensburg, Germany Fon: +49 (0)700 XLHOSTDE [0700 95467833] Fax: +49 (0)721 151 463027 ICQ: 27139974 - IRC: #XLhost@quakenet WEB: http://www.XLhost.de
Johan Carlsson wrote at 2005-3-2 13:16 +0100:
... What differences and/or similarities are there between new style classes and ExtentionClasses?
"ExtensionClass" is a type implemented in C that already a long time ago brought functionality similar to descriptors and other new style class features. Now that Python itself provides such functionality, "ExtensionClass" could be obsolete -- but unfortunately, there is a huge amount of software depending on it. Of course, Python's new style classes are not simply an extension to "ExtensionClass" but something quite different (though with similar functions). For Zope2.8, Jim has reimplemented "ExtensionClass" on top of Python's new style classes. This new style "ExtensionClass" is (mostly) an extension to the old "ExtensionClass". For Zope3, "ExtensionClass" is no longer used.
For instance how does Acquisition work in Zope3/Zope2.8? Any docs I can (should) read?
Acquisition is no longer used (by default) in Zope3 (which I am sad for). When you need it, you would use so called "ContextWrapper"s. In Zope2.8, acquisition works as before. The wrapper objects are now just new style ExtensionClasses. -- Dieter
Dieter Maurer wrote:
Johan Carlsson wrote at 2005-3-1 09:52 +0100:
... How about Zope3. Are ExtentionClasses use in Zope3?
No.
Zope3 uses the new "Persistent" objects which are new style classes.
Cool. Thanks. /Johan -- Johan Carlsson Tel: + 46 8 31 24 94 Colliberty Mob: + 46 70 558 25 24 Torsgatan 72 Email: johanc@easypublisher.com SE-113 37 STOCKHOLM
participants (4)
-
Chris Withers -
Dieter Maurer -
Johan Carlsson -
Jürgen Herrmann