Here's an FYI and request for comments (if there are any): the new
widgets code includes threadsafety protection. It's not foolproof, but
I think it will eliminate the common problem that I've seen when
people have been writing their widgets.

Widgets are designed to be reused from request to request. Since
multiple requests can come in at the same time, if you store things on
"self" that change each time the widget is displayed, it's entirely
possible that two people will get the same data, even when they should
get different data.

To prevent this, when a widget is first displayed it becomes locked to
further changes. Any attempts to set self.(something) will be met with
an exception. You can still shoot yourself in the foot with
module-level variables and mutable variables, but the self.foo = "bar"
problem is something I've seen in a few widgets.

--
Kevin Dangoor
Author of the Zesty News RSS newsreader

email: [EMAIL PROTECTED]
company: http://www.BlazingThings.com
blog: http://www.BlueSkyOnMars.com

Reply via email to