On Sun, 9 Dec 2001 11:18:03 +1000 "Tom Cameron" <tom@cameron.to> wrote:
So I gather from this that it all comes down to the name - if I rename the product then I stuff things up.
Yes... although there is a facility for aliasing names when you move them named __module_aliases__. Here's an example I gave on the maillist a while ago for using __module_aliases__: It works by putting a tuple of tuples in your Product's __init__.py module in a __module_aliases__ attribute at module scope. For example, PythonScripts have the following __module_aliases__ attribute. from Shared.DC import Scripts __module_aliases__ = ( ('Products.PythonScripts.Script', Scripts.Script), ('Products.PythonScripts.Bindings', Scripts.Bindings), ('Products.PythonScripts.BindingsUI', Scripts.BindingsUI),) .. this maps the module that *used* to be at Products.PythonScripts.Script to the module that is *now* at Scripts.Script, etc. This only works with modules and not with classes or other types. This is a hack.
Is there anyway to query what class an object is instanced off? And also to edit this i.e. in the event that the class may have been renamed.
All instances have an attribute __class__ that can be used to tell what class they are from. Cant edit an instance if it can't be loaded from the ZODB.