[ZPT] A simpler way?
Mon, 29 Jul 2002 10:31:56 +0100
On 28/7/02 9:28 am, "Chris Withers" <email@example.com> wrote:
> Hey Tone :-)
Hey hey Chris :) (we UK-Zopers stick together donchaknow?)
> Tony McDonald wrote:
>> The equivalent in PT is this;
>> <td colspan="2" tal:content="structure
>> here.edit_map_bc(here, request), here.home_map_staff(here, request))">
>> What user map to show.
>> I've been doing PT for quite some time now, but that little construct took
>> *ages* to figure out.
> Which bit of the construct took the most time to come up with?
The here.home_map_staff(here, request) bits mainly. Nothing seemed to gel
>> I suppose my question is in two parts really; is there a cleaner way of
>> doing the if-then-else construct?
> I'd probably to it as:
> <td colspan="2" tal:define="isUser
> <tal:x condition="isUser" replace="here/edit_map_bc"/>
> <tal:x condition="not:isUser" replace="here/home_map_staff"/>
Aha - very nice. It needs a small change tal:define="isUser python: , and
the replace=" needs a structure ... But works very well (and is quite a bit
cleaner than my effort). Ie
<td colspan="2" tal:define="isUser python:
<tal:x condition="isUser" replace="structure here/edit_map_bc"/>
<tal:x condition="not:isUser" replace="structure here/home_map_staff"/>
> ...but mixing DTML and ZPT like this will often look horrible :-S
Oh I do agree there.
>> And is anyone aware of large-scale PT
>> projects that I can glean PT-like idioms from?
> Zope 3 ;-)
There be dragons...it's still a CVS download isn't it? But... If it helps,
that might be the way to go.
> But, there also the language references:
> ...and the tutorial:
Oh those are fine resources, and well-thumbed (and the Zope book: CH5 and
Appendix C) - I've even added a HowTo on using METAL at the Zope site, so
I'm not a complete clueless newbie :). Thing is that learning ZPT by example
is a lot better than the artificial constructs in the manuals. I learnt
heaps from the 'show_source' link at Zope.org. It seems that nothing like
that exists for ZPT.
Thanks for the help Chris,
Dr Tony McDonald, Assistant Director, FMCC, http://www.fmcc.org.uk/
The Medical School, Newcastle University Tel: +44 191 243 6140
A Zope list for UK HE/FE http://www.fmcc.org.uk/mailman/listinfo/zope