[Zope3-Users] syncing object view after an attribute change

Gary Poster gary at zope.com
Fri Feb 24 10:58:45 EST 2006


On Feb 21, 2006, at 8:22 AM, Joel Moxley wrote:

> Hi all,
>
> I've been developing an app, and I keep running into this problem.
> Briefly, the object view loaded in my page will be one step out of
> sync with a change I make on the object.  This seems to be something
> very basic that I am missing, but I have not been able to find an
> appropriate fix and instead rely on the simple workaround of pressing
> "refresh" in my browser.
>
> By way of an example, I have a parent container with child objects.
> In the container page template view, I have a simple input form that
> calls a function deleting all child objects.
>
>     <td colspan="7" tal:define="result view/formClearAll">
>       <form>
>         <input type="submit" name="CLEAR_ALL" value="Clear All"/>
>       </form>
>     </td>
>
> When I press "Clear All", the new page shows the views on the old
> child objects.  When I press refresh, the new page now correctly has
> removed the child objects.
>
> Can someone please give me a pointer on how to remedy this and get my
> views back in sync?

This sounds like an update bug: you are rendering, or collecting some  
data for the rendering, before you have finished updating your data  
for the transaction.  This is why formlib has two explicit stages,  
update and render.  I'd think about dividing up your work in those  
two categories: you'll probably catch what the problem is.

Gary


More information about the Zope3-users mailing list