showard | ff90138 | 2008-07-07 23:22:16 +0000 | [diff] [blame] | 1 | import threading |
2 | |||||
3 | _store = threading.local() | ||||
showard | 64a9595 | 2010-01-13 21:27:16 +0000 | [diff] [blame] | 4 | _store.user = None |
showard | ff90138 | 2008-07-07 23:22:16 +0000 | [diff] [blame] | 5 | |
6 | def set_user(user): | ||||
7 | """\ | ||||
8 | Sets the current request's logged-in user. user should be a | ||||
9 | afe.models.User object. | ||||
10 | """ | ||||
11 | _store.user = user | ||||
12 | |||||
13 | |||||
14 | def get_user(): | ||||
15 | 'Get the currently logged-in user as a afe.models.User object.' | ||||
16 | return _store.user |