[Zope] templates in instance and class?

Peter Bengtsson mail@peterbe.com
Thu, 20 Dec 2001 19:31:06 +0100


Suppose you have a ZClass which holds a couple of methods, scripts and 
templates. 
It is an advantage to keep the templates inside the ZClass if you upgrade the 
product and don't have to change the instance.
Likewise it is also an advantage to "take control" over the templates for 
translations and branding etc unique to that instance.

How can this be combined?

Ultimatly I would like to be able to (from inside the instance) choose from 
available templates, methods or scripts and take control over them. Then one 
could (almost like versioning) check if there is a new version of the ZClass 
template and in that case perhaps "download" that and do the modifications 
you need to do again.
I see this not as a modification to how Zope and ZClasses work but as a 
feature to my ZClass. The only problem is how to keep two objects of the same 
id. One "baseobject" in the ZClass and one in the instance.

Following is a hack that could do; but it is a hack.

-- in ZClass method template called 'index_html' (pseudo code) --
if hasattr(context,'index_html_instance'):
    return context.index_html_instance()
else:
    return context.index_html_base()


Any ideas or smart solutions to this?