53633d7e41eb0c0ef112d88d5e331896d5e166fa
1 from pylons
import c
, session
3 from spline
.lib
.plugin
import PluginBase
4 import spline
.model
as model
5 import spline
.model
.meta
as meta
7 import controllers
.accounts
8 import model
as user_model
10 def check_userid_hook(action
, **params
):
11 """Hook to see if a user is logged in and, if so, stick a user object in
15 if not 'user_id' in session
:
18 user
= meta
.Session
.query(model
.User
).get(session
['user_id'])
20 # Bogus id in the session somehow. Clear it
21 del session
['user_id']
28 class UsersPlugin(PluginBase
):
29 def controllers(self
):
31 accounts
= controllers
.accounts
.AccountsController
,
35 return [user_model
.User
, user_model
.OpenID
]
39 ('before_controller', 1, check_userid_hook
),