[Zope] Add property to DTML Document, not via a script?
Roger Erens
r.erens@eurosys.nl
Wed, 17 Oct 2001 17:27:07 +0200
Hello all,
I've got this:
Root Folder
--AddPlayer (DTML Method)
--AddPlayerScript (Python Script)
--Players (Folder)
--Player1 (DTML Document)
--Player2 (DTML Document)
--...
To add a player (DTMLDocument) in the Players folder and then add a property
to the newly created DTMLDocument I needed to take refuge to calling the
Python script (as is shown in chapter 5 of the Zope Book).
Could someone give me the 'DTML translation' of the script so that I can
keep the functionality together in the AddPlayer DTMLMethod?
I think I would need something like
<dtml-call expr="Player3.manage_addProperty('Score', 0.00, 'float')">
but with something instead of the hardcoded 'Player3'.
This is the AddPlayer method:
[snip]
<dtml-with Players>
<dtml-let NewPlayerID="'Player3'">
<dtml-call
expr="manage_addDTMLDocument(id=NewPlayerID,title='nonsense')">
<dtml-call expr="AddPlayerScript(NewPlayerID)">
</dtml-let>
</dtml-with>
[snip]
And this is the AddPlayerScript (called with the parameter playerID):
[snip]
doc=getattr(context,playerID)
doc.manage_addProperty('Score', 0.00, 'float')
[snip]
PS: Yes, in the long run, I *will* put all the functionality in a
Pythonscript and skip the DTMLmethod alltogether.
First I want to understand this stuff.