I just came across this thread, and was really suprised by this:

Bob Ippolito wrote:
> On Dec 30, 2005, at 2:42 PM, Sean De La Torre wrote:
>
> > This may be a dumb question, but I'll ask anyway.  Why is it not
> > threadsafe?
>
> It's not threadsafe because the same widget instance is used across
> requests

I hope I'm missing something, because I don't see how this can be the
case-- or if it is the case, I don't see how it could be workable. If I
use a widget, I'm not able to change its properties after
instantiation? In other words, this is not ok (excuse any misspelling,
I'm away from my own machine):

def whatever(self, **kw):
    foo = widgets.TextField('bar')
    if kw.get('something'):
        foo.attr['class'] = 'one'
    else:
        foo.attr['class'] = 'two'
    ...

Is it really the case that the above is not threadsafe? If not, where
in the request cycle does the widget become (potentially) shared --
only inside of the template? Or am I just misunderstanding something?

If I'm not just on crack here, I'd argue that shared widgets anyplace
is bad; not being able to manipulate widgets per-request is going to
trip a lot of people up, especially since it's going to cause the sorts
of bugs that only appear in real-world use and cause developers to say
"well, I can't reproduce it [with my single-thread dev config]...."

JP

Reply via email to