ZClass inheritance and properties (Zope 2.3.0)
Hello, I found another more subtle problem with ZClass properties. When I create two ZClasses, one of which is the parent of the other, some properties seem not be inherited properly. I create one class ("parent") with parent classes ZObject, CatalogAwareBase and ZObjectManager. This class has among others a property called "date1" of type Date. I create another class ("child") with parent classes ZObject, parent (from above) and ZDTMLDocument. Now the problem is that the date1 property is not set properly when I put a new value for "date1" an the REQUEST and call propertysheets.Basic.manage_editProperties(REQUEST) (which updates all other properties of "child" properly). Also "date1" doesn't show up in the properties tab of any "child" object. (Are inherited properties meant to do this??? If not it might be a good idea that they do. The property sheet should maybe show inherited properties in a different color etc.) However when I try to create a new property called "date1" in the "child" property sheet I get an error: "Invalid property id, date1. It is in use." Is this the right way I am using kind of multiple inheritance here? What am I doing wrong? (I am running Zope 2.3.0 on RedHat Linux 6.0) Thanks --Oliver
Hi, Oliver Oliver Frommel wrote:
Hello,
I found another more subtle problem with ZClass properties. When I create two ZClasses, one of which is the parent of the other, some properties seem not be inherited properly.
I create one class ("parent") with parent classes ZObject, CatalogAwareBase and ZObjectManager. This class has among others a property called "date1" of type Date.
I create another class ("child") with parent classes ZObject, parent (from above) and ZDTMLDocument.
Now the problem is that the date1 property is not set properly when I put a new value for "date1" an the REQUEST and call propertysheets.Basic.manage_editProperties(REQUEST) (which updates all other properties of "child" properly).
What propertysheet is date1 on in the parent class?
Also "date1" doesn't show up in the properties tab of any "child" object. (Are inherited properties meant to do this??? If not it might be a good idea that they do. The property sheet should maybe show inherited properties in a different color etc.) However when I try to create a new property called "date1" in the "child" property sheet I get an error: "Invalid property id, date1. It is in use."
Assure that you have a view established for that propertysheet in the parent ZClass, then it will appear in the list of available things for a view in the child ZClass.
Is this the right way I am using kind of multiple inheritance here? What am I doing wrong? (I am running Zope 2.3.0 on RedHat Linux 6.0)
hth, -- Jim Washington
Now the problem is that the date1 property is not set properly when I put a new value for "date1" an the REQUEST and call propertysheets.Basic.manage_editProperties(REQUEST) (which updates all other properties of "child" properly).
What propertysheet is date1 on in the parent class?
the propertysheets of both the parent and child are called "Basic". So the "Basic" property sheet of "parent" contains the "date1" property.
Also "date1" doesn't show up in the properties tab of any "child" object. (Are inherited properties meant to do this??? If not it might be a good idea that they do. The property sheet should maybe show inherited properties in a different color etc.) However when I try to create a new property called "date1" in the "child" property sheet I get an error: "Invalid property id, date1. It is in use."
Assure that you have a view established for that propertysheet in the parent ZClass, then it will appear in the list of available things for a view in the child ZClass.
I have a view called "Properties" containing "properties/Basic/manage" for "parent". I understand that when I establish a new view selecting "properties/Basic/manage" in the child's view tab I manage the property sheet of the child, which still doesn't show any of the parents properties. Did I miss anything? --Oliver
Hi, Oliver I believe that what you have done is overridden the parent's propertysheet by making a new one in the child by the same name. Whether that is the correct behavior is perhaps a matter of debate, but in the current implementation of ZClasses, you need to use different propertysheet names in parent and child in order for the child to access the parent's propertysheets. -- Jim Washington Oliver Frommel wrote:
Now the problem is that the date1 property is not set properly when I put a new value for "date1" an the REQUEST and call propertysheets.Basic.manage_editProperties(REQUEST) (which updates all other properties of "child" properly).
What propertysheet is date1 on in the parent class?
the propertysheets of both the parent and child are called "Basic". So the "Basic" property sheet of "parent" contains the "date1" property.
Also "date1" doesn't show up in the properties tab of any "child" object. (Are inherited properties meant to do this??? If not it might be a good idea that they do. The property sheet should maybe show inherited properties in a different color etc.) However when I try to create a new property called "date1" in the "child" property sheet I get an error: "Invalid property id, date1. It is in use."
Assure that you have a view established for that propertysheet in the parent ZClass, then it will appear in the list of available things for a view in the child ZClass.
I have a view called "Properties" containing "properties/Basic/manage" for "parent". I understand that when I establish a new view selecting "properties/Basic/manage" in the child's view tab I manage the property sheet of the child, which still doesn't show any of the parents properties.
Did I miss anything?
thanks, this works, at least I can add a view to the child with the property sheet of the parent. However this is not exactly what I want cause I'd rather have the parent's properties on the same view. Another problem is that I need to call both propertysheets' manage_editProperties methods (and possibly even more if I want to change properties from other parent classes if I understand this right?) thanks for your help anyway :) Oliver
I believe that what you have done is overridden the parent's propertysheet by making a new one in the child by the same name. Whether that is the correct behavior is perhaps a matter of debate, but in the current implementation of ZClasses, you need to use different propertysheet names in parent and child in order for the child to access the parent's propertysheets.
-- Jim Washington
participants (2)
-
Jim Washington -
Oliver Frommel