[Zope] Changing Properties With ZPT
Andreas Jung
lists at andreas-jung.com
Wed Aug 10 03:00:12 EDT 2005
--On 9. August 2005 21:37:11 -0400 Dyyryath <dyyryath at zerothelement.com>
wrote:
> I'm trying to figure out how I can change the properties of a template
> with ZPT. For example, let's say I've got a Page Template with a
> property called 'name' and I want to change it in response to something
> in the HTTP request:
>
> <div tal:condition="python:'name' in context.REQUEST">
> SOME CODE TO CHANGE THE PROPERTY TO EQUAL context.REQUEST['name']
> </div>
>
> I haven't seen anyway to do this with ZPT so I'm assuming that I'll need
> to use a python script of some sort, but I'm not sure how to access the
> template's properties without hardcoding the template's name.
>
Your question indicates that you have not understand yet that everything in
Zope is an object with a unique API. Objects can be modified by calling
their API from within ZPT, PythonScripts, external methods, product code or
from wherever as long as the Zope security allows it. This means it makes
no difference to modify an object from a PythonScript or from a ZPT *as
long* as you know its API. What you want is provided by the PropertyManager
API (see Zope Book Appendix B -> PropertyManager).
-aj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 186 bytes
Desc: not available
Url : http://mail.zope.org/pipermail/zope/attachments/20050810/da22d24c/attachment.bin
More information about the Zope
mailing list