On Jul 18, 2006, at 11:15 PM, Donald Ball wrote:
> (...)
> Also, one wonders about the safety of multiple threads using same
> user_form instance simultaneously, but that's another topic I have  
> yet to
> even dive into.

There should be no thread-safety issues if you keep in mind that  
widgets should be stateless. This means you *shouldn't* change it's  
attributes once the widget is first displayed. Currently there's a  
mechanism that "locks" the widget's attributes and raises an  
exception when you try to rebind them, but it's not completely fool- 
proof and will let you shoot yourself in the foot with mutable  
attributes such as dicts or lists.

Alll data massagging should be done in the update_params method which  
is the one that has the last chance to modify the dict that feeds the  
widget's template.

To sum up:

Good:

form = Form(fields = [....]))

Bad:

form = Form()
... form is displayed, etc...
form.fields.extend([...])

Michele elaborates on this at http://trac.turbogears.org/turbogears/ 
wiki/StatelessWidgets.

HTH,
Alberto

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~----------~----~----~----~------~----~------~--~---

Reply via email to