mirror of
https://github.com/jupyterhub/jupyterhub.git
synced 2025-10-15 05:53:00 +00:00
Address review in named_servers
from willingc - consistency of repr/str when logging usernames - cleanup some attribute declarations - add comments about db session weirdness
This commit is contained in:
@@ -88,6 +88,7 @@ class User(HasTraits):
|
||||
def _log_default(self):
|
||||
return app_log
|
||||
|
||||
spawners = None
|
||||
settings = Dict()
|
||||
|
||||
db = Any(allow_none=True)
|
||||
@@ -103,7 +104,10 @@ class User(HasTraits):
|
||||
# db session changed, re-get orm User
|
||||
db = change.new
|
||||
if self._user_id is not None:
|
||||
# fetch our orm.User from the new db session
|
||||
self.orm_user = db.query(orm.User).filter(orm.User.id == self._user_id).first()
|
||||
# update our spawners' ORM objects with the new session,
|
||||
# which can be found on our new orm_user.
|
||||
for name, spawner in self.spawners.items():
|
||||
spawner.orm_spawner = self.orm_user.orm_spawners[name]
|
||||
|
||||
@@ -116,8 +120,6 @@ class User(HasTraits):
|
||||
else:
|
||||
self._user_id = None
|
||||
|
||||
spawners = None
|
||||
|
||||
@property
|
||||
def authenticator(self):
|
||||
return self.settings.get('authenticator', None)
|
||||
|
Reference in New Issue
Block a user