[Zope] DTML Document Properties strangeness
Martijn Faassen
M.Faassen@vet.uu.nl
Wed, 02 Jun 1999 15:55:22 +0200
Brian Lloyd wrote:
[snip]
> The "self" in your "getPropertyIds" external method is going to be
> the _folder_, not the DTML Document. In a DTML Document, the implicit
> "self" namespace is the DTMLDocument itself, but this does extend
> to any method-like objects called from the DTML Document - they
> will continue to act as methods of their containers (and _not_ like
> methods of the DTML Document).
The confusing thing is that a DTML Document is according to the
documentation:
"""DTML Document objects are DocumentTemplate.HTML objects that act as
methods
whose self is the DTML Document itself."""
I thought that this would mean the 'self' argument passed to an external
method would be the 'self' of the DTML document, not the containing
folder.
> One thing you could do to accomplish what you are trying to do
> is to extend your getPropertyIds() method to accept an argument:
>
> def getPropertyIds(self, obj):
> return obj.propertyIds()
>
> <!--#var "getPropertyIds(this())"-->
Yes, I suppose I'll have to go for that, but it takes away some of the
simplicity of my External Method. It pulls text from properties and
renders them in a page as structured text. If you're logged in as
Manager, you get an extra hyperlink with the text. If you click on it,
you get a simple web page with a textarea box on it. You can type in new
structured text, press okay, and voila, the text on the page is changed.
The DTML that accomplishes all this (along with the supporting editor
page and the external method) is just:
<!--#var "editable('some_property')"-->
Now it'd have to be:
<!--#var "editable(this(), 'some_property')"-->
More typing! :) Anyway, it'll have to do -- this is mainly a hack for
demo purposes. Later on (this summer!) we're planning to build simple
authoring tools on top of your membership system to be (at least I hope
-- I don't know anything about the membership system so I don't know if
it'll suit our needs; any chance some info is leaking out soon?). The
idea is that the website here can be kept up to date by allowing
maintainers (each page has a list of maintainers) to edit their web
pages from the web in a very _very_ simple way (no HTML knowledge
required).
If all these plans go through you're bound to hear more on this later.
:)
> Hope this helps!
Thanks, it does. I think I saw 'this()' before but couldn't find how to
do that the other day when I was looking for it.
Regards,
Martijn