How can I create static member variables for a product?
Hi All, Is there any way to create a product with static member variables? For example. The properties should be common for all the instance of same product. That property can be an attribute of the product. With Regards Naveen pnaveen@zeomega.com
Hi Naveen, --On Montag, 25. November 2002 22:44 +0530 Naveen <pnaveen@zeomega.com> wrote:
Hi All,
Is there any way to create a product with static member variables?
For example. The properties should be common for all the instance of same product. That property can be an attribute of the product.
This is exactly what (Z)Class Properties use to do :-) Regards Tino
Hello Tino, Thanks for your reply. Here what I did. I did this using 'Add Product' from control panel(Product Management)' later I added ZClass to it. I added an property sheet in it. At the end I have created two instance instance of that zclass. I have changed the the property in one instance. When I look into another instance of same product does not seem to be changed. Any idea? With Regards Naveen pnaveen@zeomega.com On Mon, 25 Nov 2002, Tino Wildenhain wrote:
Hi Naveen,
--On Montag, 25. November 2002 22:44 +0530 Naveen <pnaveen@zeomega.com> wrote:
Hi All,
Is there any way to create a product with static member variables?
For example. The properties should be common for all the instance of same product. That property can be an attribute of the product.
This is exactly what (Z)Class Properties use to do :-)
Regards Tino
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Hi Naveen, --On Dienstag, 26. November 2002 11:39 +0530 Naveen <pnaveen@zeomega.com> wrote:
Hello Tino, Thanks for your reply.
Here what I did.
I did this using 'Add Product' from control panel(Product Management)' later I added ZClass to it. I added an property sheet in it.
At the end I have created two instance instance of that zclass. I have changed the the property in one instance.
When I look into another instance of same product does not seem to be changed.
Sure, if you change the property in the instance, you put a copy of the attribute in the instance thus overlapping with the attribute still provided with the class. So you dont change the class attribute but you have a new changeable attribute in the object with same name. The other, unchanged instance of course sees the class attribute. This is standard behavior of OO languages as far as I see. You could provide a method to change the classes attribute, which calls Products.YourProduct.YourZClass.propertysheets.yourpropertysheet.edit_prope rties() or change_properties() for it. Compare: class Foo: a="I'm of foo" A=Foo() B=Foo() B.a="I'm b-ish" print B.a -> I'm b-ish print A.a -> I'm of foo Foo.a="I'm changed" print A.a -> I'm changed print B.a -> I'm b-ish (still) HTH Tino Wildenhain
Any idea?
With Regards Naveen pnaveen@zeomega.com
On Mon, 25 Nov 2002, Tino Wildenhain wrote:
Hi Naveen,
--On Montag, 25. November 2002 22:44 +0530 Naveen <pnaveen@zeomega.com> wrote:
Hi All,
Is there any way to create a product with static member variables?
For example. The properties should be common for all the instance of same product. That property can be an attribute of the product.
This is exactly what (Z)Class Properties use to do :-)
Regards Tino
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
participants (2)
-
Naveen -
Tino Wildenhain