[Grok-dev] Viewlets and update/render

Graham Stratton gns24 at mythic-beasts.com
Sun Jun 15 01:26:36 EDT 2008


Hi all,

I've written a couple of apps using viewlets now, and my experience  
has been generally very positive. However, I am a bit confused on a  
couple of points regarding the update()/render() pattern.

I originally thought that the idea of the update/render pattern was to  
call all the update() methods, which process all the form inputs and  
update the data structures, and to then call the render() methods to  
produce the new page.

This works fine within a single viewlet manager, but if the update()  
of a viewlet affects the rendering of something earlier in the page  
then it fails. I'm currently working around this by calling a redirect  
after each form update, but I expect this isn't good practice.

I've also seen some code around (and written some) which uses update()  
to store values on the viewlet for use in template rendering, which  
potentially conflicts with updating the data before deciding what to  
render. What's the preferred approach?

Thanks,

Graham


More information about the Grok-dev mailing list