models.Account.current_user_account

0 views
Skip to first unread message

adam

unread,
Nov 3, 2009, 11:23:26 AM11/3/09
to codereview-discuss
AddUserToRequestMiddleware stores the current user's Account in a
static variable, models.Account.current_user_account. I thought this
was strange and guessed that static variables in Python must be thread-
local... but as it turns out they're not. So, as far as I understand,
it's quite easy for one request to get another user's Account instance
as models.Account.current_user_account, so long as they both hit the
web server at approximately the same time.

is my understanding correct? What is up with this design decision? I'm
just learning Django, Python, and GAE so I'd like to use only the best
examples.

Thanks,
Adam

Guido van Rossum

unread,
Nov 3, 2009, 12:24:49 PM11/3/09
to coderevie...@googlegroups.com
App Engine runs your Python apps single-threadedly (instead using
multiple processes if requests come in faster than they can be
handled).
--
--Guido van Rossum (python.org/~guido)
Reply all
Reply to author
Forward
0 new messages