[ZPT] No proxy roles in page templates? What do I do then?
Itai Tavor
itai@optusnet.com.au
Fri, 5 Oct 2001 08:38:25 +1000
R. David Murray wrote:
>On Thu, 27 Sep 2001, Itai Tavor wrote:
>> duplication of code as well as waste of time. It will also make the
>> verification code itself more complicated, but I won't go into that
>> here. Or, I could write a single script for each UI method, which
>> would verify the user, then pull all the data that the UI method
>> requires, and return it in a dictionary to the PT. So now I would
>> need two methods for every one I used to have, and the PT would
>> become less clear and harder to manage.
>
>Ah, but a script-per-pt returning a dictionary of data needed
>by the pt is, I believe, considered Good Practice by Evan, and
>it makes sense to me (a lot of sense). Keep the logic
>out of the pt as much as possible! It should actualy simplify
>your verification code, since you'll be able to do it using
>clean python syntax rather than clunky dtml.
Thanks, I'm starting to get it now. Getting logic of of PTs this way
does make sense.
Regarding the verification code, it's already in a python method
that's called from the PT, so all I have to do is move the call to
the new script/method (it would really be a method in a
filesystem-based product, because that's where the whole project
lives, other than the PTs).
What I still don't like about this solution, is that in some cases it
is totally unnecessary and makes no sense, such as calling protected
'view' methods that return HTML snippets. Instead of simply doing
tal:replace="someobject/view" I need a separate script just to get
and return the HTML. In cases like this a separate script is
wasteful, and the lack of proxy roles is simply annoying, and serves
no purpose.
Thanks,
Itai
--
--
Itai Tavor -- "Je sautille, donc je suis." --
itai@optusnet.com.au -- - Kermit the Frog --
-- --
-- "If you haven't got your health, you haven't got anything" --