[Zope3-dev] update called twice for editview

Stuart Bishop stuart at stuartbishop.net
Mon Sep 6 12:08:28 EDT 2004


On 01/09/2004, at 3:23 AM, Garrett Smith wrote:

> The use of tal:tag at the top of edit.pt (z.a.form.browser) as well as
> tal:define in line 18 results in update being called twice for the edit
> view.
>
> I'm not sure what 'tal:tag' is generally for, but I imagine it is used
> here to ensure that objects are updated before the form is displayed 
> (to
> ensure the page displays the current values).

<tal:tag condition="view/update"/> is equivalent to
<span tal:omit-tag="" tal:condition="view/update" />

It is indeed there to ensure that everything is updated before 
attempting
to render the form.

> Ideally, we could define 'status' in the first line to accomplish what
> we needed in a single call to update.

Yup.

> AFAIC, this is a performance related issue that should be fixed -- I'm
> happy to do it, but need some help using tal:tag. This would also be
> possible using a slot in the main template for code needed to be
> evaluated before the rest of the page is rendered, but I'm hoping
> there's an easier path.

<tal:x define="status view/update">
  <html metal:use-macro="context/@@standard_macros/view">
    [...]
</tal:x>

This is just XML namespaces at work, with the additional detail that
tags with unknown namespaces are thrown out by page templates when
rendered. It is actually quite common in Zope2 code :-)

--  
Stuart Bishop <stuart at stuartbishop.net>
http://www.stuartbishop.net/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 186 bytes
Desc: This is a digitally signed message part
Url : http://mail.zope.org/pipermail/zope3-dev/attachments/20040907/242588f8/PGP.bin


More information about the Zope3-dev mailing list