Stephen Simmons wrote:
> I have tried to create another ZClass, AdminTools:Task that inherits from
> AdminTools:Folder that adds some task tracking functionality and
> uses/overrides the AdminTools:Folder methods for displaying objects
I tend to try not to have ZClasses derive from other ZClasses. You'd
find it more straightforward either to derive both ZClasses from a
common Python base class, or to keep both ZClasses independent of each
In general, I try to avoid using inheritence. Python and Zope support
polymorphism whether you derive classes from the same base-class or not.
Also, I find the coupling introduced by inheritence more trouble than it
is worth for the reduced redundancy.
I realize that I have avoided trying to answer why ZClasses work in this
> File D:\Dev\ZopeTestbed\lib\python\OFS\PropertySheets.py, line 235, in
> (Object: Task)
> Bad Request: (see above)
> I don't understand why I can add the 'title' property to Task but not
Here's the code that is raising the exception:
if not (id=='title' and not self.__dict__.has_key(id)):
raise 'Bad Request', (
'Invalid property id, <em>%s</em>. It is in use.' % id)
You can see that 'title' has a special status as a property.
> To conclude:
> (i) What is going on and how can I fix it?
Don't do things that way to start with.
> (ii) When using a ZClass as a base class, do instances inherit any
> properties, or do they just get access to the base class's methods? If
> ZClasses do inherit properties from parent ZClasses, how do I reach them via
> the property sheets?
If you add propertysheets to instances of your classes, rather than to
the classes, then you don't get conflicts over attributes. However,
unless you use ZPatterns or something like that, you have to refer to
the attributes of propertysheets explicitly naming the propertysheet.
> (iii) Is there a simple way to find out what methods and properties an
> object has? I would like to see what it defines, what it inherits and what
> it acquires.
Yes. See the code above from PropertySheets.py. Use something like this
in an external method to find out the attributes of an object. (In
python, methods and fields are both attributes.) You can use the magic
aq_* attributes of acquisition wrappers to walk through the objects that
get considered during acquisition. You might also want to look at Shane
Hathaway's Acquisition Explainer, an external method to show how
acquisition works, that also demonstrates use of the aq_* attributes.
Zope maillist - [EMAIL PROTECTED]
** No cross posts or HTML encoding! **
(Related lists -