Python Script that modifies a document property
Frustrated... I want to have a python script that, when called from a dtml-document, will modify the properties of that document[1]. How do I get to the document itself? context and container both reference the the folder with the python script in it! -- cary [1] In the long run I want a unconnected (not-in-a-z-class) python script that can do things to a z-class that has properties and acts like a folder and has things in it. I want the script to be able to modify properties based on other properties, and access the sub-objects. Think workflow rules.
Hi Cary! If it really is a dtml *document*, then "context" refers to the document itself, since it's the one that's calling the script, and you should be fine. Make sure you don't use a dtml *method*, since it will not bring its own namespace with it (by default). Danny
-----Ursprungliche Nachricht----- Von: zope-admin@zope.org [mailto:zope-admin@zope.org]Im Auftrag von Cary O'Brien Gesendet: Donnerstag, 12. April 2001 09:58 An: zope@zope.org Betreff: [Zope] Python Script that modifies a document property
Frustrated...
I want to have a python script that, when called from a dtml-document, will modify the properties of that document[1]. How do I get to the document itself? context and container both reference the the folder with the python script in it!
-- cary
[1] In the long run I want a unconnected (not-in-a-z-class) python script that can do things to a z-class that has properties and acts like a folder and has things in it. I want the script to be able to modify properties based on other properties, and access the sub-objects. Think workflow rules.
_______________________________________________ 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 )
From: "Cary O'Brien" <cobrien@Radix.Net>
I want to have a python script that, when called from a dtml-document, will modify the properties of that document[1]. How do I get to the document itself? context and container both reference the the folder with the python script in it!
Pass it as an argument. DTML's magic can be helpful, but it can also get in your way, and saying what you mean can save you confusion later: <dtml-call expr="myScript(this())"> Alternatively, you can use the Bindings tab of the Script to get the caller's namespace, and refer to the Document as: _['this'] Cheers, Evan @ digicool & 4-am
participants (3)
-
Cary O'Brien -
Danny William Adair -
Evan Simpson