[Zope] Problems with zclass and instances!!

Edgardo Zulian ezulian@elsitio.com.ar
Thu, 2 Aug 2001 11:18:32 -0300


This is a multi-part message in MIME format.

------=_NextPart_000_1FA9_01C11B44.DD2E4E10
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi there:

I have created a product 'X' with a zclass call 'X1'. This X1 zclass in =
the propertysheet has a Common Instance Property Sheet called  'section' =
 (/Control_Panel/Products/X/X1/propertysheets/common/section), with some
properties with default values:
ie. one of it's property is call ed  'section1' with the default value =
'left side', the type of   this property is 'string':
section1  'left side'    string

Then in the views  of  the zclass I 've  added  a method =
"propertysheets/section/manage",=20
so when I create an instance I can enter to this propertysheet.


So the problem is here:

 When I create an instance of this  'X1' zclass an I enter to this =
propertysheet/section ,   I can change the default value of 'section1' =
which was 'left side' to 'center side' for example.

But then if i change the original default value of my zclass 'X1' to =
'right side' let say. The change will not be reflected in my instance,   =
which is okey because i have change d  the value to 'center side' =
before.

Another case is when I  create another instance  of 'X1' zclass   =
without making any change to the value of 'section1'  and click on save =
changes, then if I change the default value in the zclass, the change =
will not be reflected in this instance.

So the question is:

There is a way to recognize when an instance will not take the changes =
that are make to the default values of a propertysheets (in this case =
thepropertysheet 'section' )  of a zclass from which they inheritance?

 I try with this lines in an external method, but nothing:

   self=3Dself._getOb('instanceTest')         # instanceTest is the name =
of the instance of the 'X1 Zclass'
   a=3Dgetattr(self,'meta_type')
   b=3Dgetattr(self.__class__,'meta_type')
   # in this example the answer was the same: X1

   a=3Deval('self.__class__.propertysheets.section._propertyMap()')
   b=3Deval('self.propertysheets.section._propertyMap()')
   # the answer was again the same: {'id': 'section1', 'type': =
'string','meta': {}, 'mode': 'w'}

   #I try acceding to the zclass to know if it was different from =
theinstance...
   =
a=3Deval('self.Control_Panel.Products.X.propertysheets.common.section.pro=
pertyMap()')
   # the answer not help: {'id': 'section1', 'type': 'string', 'meta': =
{}},

I cannot found any property or something that help me...

I don't know where to look or what to try next....if anybody can help me =
with this.......

Thanks in advance
Edgardo




------=_NextPart_000_1FA9_01C11B44.DD2E4E10
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 5.50.4522.1800" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2><FONT face=3D"Times New Roman" =
size=3D3>Hi=20
there:<BR><BR>I have created a product 'X' with a zclass call 'X1'. This =
X1=20
zclass in the propertysheet has a Common Instance Property Sheet =
called&nbsp;=20
'section'&nbsp; =
(/Control_Panel/Products/X/X1/propertysheets/common/section),=20
with some<BR>properties with default values:<BR>ie. one of it's property =
is call=20
ed&nbsp; 'section1' with the default value 'left side', the type =
of&nbsp;&nbsp;=20
this property is 'string':<BR>section1&nbsp; 'left =
side'&nbsp;&nbsp;&nbsp;=20
string<BR><BR>Then in the views&nbsp; of&nbsp; the zclass I 've&nbsp;=20
added&nbsp; a method "propertysheets/section/manage", =
</FONT></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><FONT face=3D"Times New Roman" =
size=3D3>so when I=20
create an instance I can enter to this=20
propertysheet.<BR></FONT></FONT></DIV><FONT face=3DArial size=3D2><FONT=20
face=3D"Times New Roman" size=3D3>
<DIV><FONT face=3DArial size=3D2></FONT><BR>So the problem is=20
here:<BR><BR>&nbsp;When I create an instance of this&nbsp; 'X1' zclass =
an I=20
enter to this propertysheet/section ,&nbsp;&nbsp; I can change the =
default value=20
of 'section1' which was 'left side' to 'center side' for =
example.<BR><BR>But=20
then if i change the original default value of my zclass 'X1' to 'right =
side'=20
let say. The change will not be reflected in my instance,&nbsp;&nbsp; =
which is=20
okey because i have change d&nbsp; the value to 'center side'=20
before.<BR><BR>Another case is when I&nbsp; create another =
instance&nbsp; of=20
'X1' zclass&nbsp;&nbsp; without making any change to the value of=20
'section1'&nbsp; and click on save changes, then if I change the default =
value=20
in the zclass, the change will not be reflected in this =
instance.<BR><BR>So the=20
question is:<BR><BR>There is a way to recognize when an =
instance&nbsp;will not=20
take the changes that&nbsp;are make to the default values of a =
propertysheets=20
(in this case thepropertysheet 'section' )&nbsp; of a zclass from which =
they=20
inheritance?<BR><BR>&nbsp;I try with this lines in an external method, =
but=20
nothing:<BR><BR>&nbsp;&nbsp;=20
self=3Dself._getOb('instanceTest')&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;=20
# instanceTest is the name of the instance of the&nbsp;'X1=20
Zclass'<BR>&nbsp;&nbsp; a=3Dgetattr(self,'meta_type')<BR>&nbsp;&nbsp;=20
b=3Dgetattr(self.__class__,'meta_type')<BR>&nbsp;&nbsp; # in this =
example the=20
answer was the same: X1<BR><BR>&nbsp;&nbsp;=20
a=3Deval('self.__class__.propertysheets.section._propertyMap()')<BR>&nbsp=
;&nbsp;=20
b=3Deval('self.propertysheets.section._propertyMap()')<BR>&nbsp;&nbsp; # =
the=20
answer was again the same: {'id': 'section1', 'type': 'string','meta': =
{},=20
'mode': 'w'}<BR><BR>&nbsp;&nbsp; #I try acceding to the zclass to know =
if it was=20
different from theinstance...<BR>&nbsp;&nbsp;=20
a=3Deval('self.Control_Panel.Products.X.propertysheets.common.section.pro=
pertyMap()')<BR>&nbsp;&nbsp;=20
# the answer not help: {'id': 'section1', 'type': 'string', 'meta': =
{}},</DIV>
<DIV><FONT face=3DArial size=3D2></FONT><BR>I cannot found any property =
or something=20
that help me...</DIV>
<DIV><FONT face=3DArial size=3D2></FONT><BR>I don't know where to look =
or what to=20
try next....if anybody can help me with this.......<BR><BR>Thanks in=20
advance<BR>Edgardo</FONT><BR><BR><BR></DIV></FONT></BODY></HTML>

------=_NextPart_000_1FA9_01C11B44.DD2E4E10--