[Zope] Class templates / meta classes
Wed, 17 Jul 2002 22:17:36 +0200
Felix Ulrich-Oltean writes:
> I am building a fairly simple On-line Shopping Product (I know there
> some out there already, but please humour me) with a number of
> ZClasses. Different shop instances will obviously need to be
> customizeable, for example the properties available for items in a
> shop might be different from shop to shop.
> How can I use my generic Shop Product to make a different Product each
> time I deploy a new shop? I am sort of looking to make a meta-class.
When you speak of single shops and not shop classes,
then you can add the properties on an instance level, when
the shop is instantiated.
When you mean shop classes, where each class is represented by
its own ZClass, then it is a bit more difficult.
You may want to read a message from me on "firstname.lastname@example.org" on abstract
Essentially, derived ZClasses can inherit methods and whole
property sheets from their base classes.
They can override inherited and define new methods.
They can define new property sheets but they cannot change
or customize inherited property sheets (e.g. define new default
Keeping this in mind, you can define a BaseShop class with most
of the shop infrastructure. Each shop class can then be implemented
by a ZClass deriving from BaseShop. They can use their own
property sheets in addition to the inherited ones.
Note: it may be easier to do this with a Python based product
rather than ZClasses.