Finally got rid of 'x.__class__.foo(x,...)' hacks! Now, if a metaclass needs to have a method that one of its instances might also have as an instance method, you can wrap it with 'binding.metamethod(foo)'. This is nice and clean because it doesn't force every caller of the 'foo' method to try and guess whether it's working with a class or an instance. Even nicer, this solution requires no special work by the person writing these methods, unless the method is going into a metaclass, and even then they need only wrap it with 'metamethod'. Last, but not least, this cleans up some of our __class__ usage so that we'll be able to work correctly with 'zope.security'. As far as I know, the 'x.__class__.foo(x,..)' trick wouldn't have worked consistently when 'x' was a proxied object, whereas a normal call to 'foo' would properly pass through the proxy barrier as long as the caller had permission to access 'foo'. (Note: at the moment 'foo' translates to the 'getParentComponent', '_getConfigData', 'getComponentName', and 'notifyUponAssembly' methods.)
Fixes and Enhancements since Version 0.5 alpha 1 - Added 'binding.metamethod()' wrapper for metaclass methods that might not be accessible from their instances if the instances (classes) also defined the method for *their* instances. You must now use this wrapper on any such metaclass-defined methods, as PEAK no longer works around this via the 'x.__class__.foo(x,...)' trick that was used previously. In particular, if you have metaclass definitions of 'getParentComponent', '_getConfigData', 'getComponentName', or 'notifyUponAssembly', you need to wrap them with 'binding.metamethod' now. - Fixed 'mof2py' generator script not working - Fixed model.Element not getting parent component set when passed as a constructor argument. - Fixed property/utility lookups not working correctly on model.* objects. - Fixed IndentedStream generating all-whitespace lines - Made 'NOT_GIVEN' and 'NOT_FOUND' recognizable by humans (they 'repr' and 'str' to their names) and by Python (they can be pickled, and when restored they come back as the same object).
cvs-admin@eby-sarna.com Powered by ViewCVS 1.0-dev |
ViewCVS and CVS Help |