[Zope-dev] ZClasses Maintenance and Upgrade

Dieter Maurer dieter at handshake.de
Wed Apr 25 15:15:25 EDT 2007


Christopher Lozinski wrote at 2007-4-16 22:21 -0700:
> ...
>I am automatically generating ZClasses, Indexes, and Formulator Form's 
>Fields.   I don't like that each parent class lists its legal children, 

Where does the parent class lists its legal children?

>I think it would be better if the child listed the legal parents.

But, then you need to have somewhere (else) a registry to list
the children types which can be added in the current place.

When you want to add something to a container, the container is
already there but not the child.

You can, of course, put the registry somewhere else (rather than in
the parent). And the lookup can even be quite complex and
look into defined ZClasses to find adequate types.

> The 
>creation of an add permission for each of the 300 ZClasses I am about to 
>generate also bothers me. 

Several ZClasses can easily share a common add permission.

>I do not quite understand the design of ZClasses.  I would expect that a 
>class has three branches.  One would be the class methods, one would be 
>the instance methods, and one would be the list of instance variables. 

Why do you want to distinguish between class and instance methods?

Even Python has learned this distinction only quite recently.

By the way, there are class methods for ZClasses -- but you cannot change
them. They are fixed for all ZClasses.

>It would be nice if each instance variable had its own permission.

Zope can protect simple values only since version 2.8.
Far too late for "ZClass"es.

>Instead ZClasses has the create method  and permissions at the same 
>level as the ZClass.  I think this is related to how zope handles 
>Products.

I think this is very normal:

  Of course, you have the "create" method on the class level
  as the class already exists but not the instance.

  Of course, you define the permissions on the class level
  to affect all instances. That is how Zope's security
  works everywhere (and not only on "ZClass"es).

> And then the instance variables are all on a propertysheet.  
>I suspect this is because of how permissions are handled, there is 
>computational efficiency in sharing a permission among the properties on 
>a propertysheet.

The main reason is that Zope only learned with Zope 2.8 how to
protect attributes with elementary values.



-- 
Dieter


More information about the Zope-Dev mailing list