From a1dc73882a3fa3937a51c8ea1745101f608d0e69 Mon Sep 17 00:00:00 2001 From: Min RK Date: Tue, 18 Sep 2018 12:45:04 +0200 Subject: [PATCH] move helper properties onto orm.Spawner since that's where they belong --- jupyterhub/orm.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/jupyterhub/orm.py b/jupyterhub/orm.py index 75eb3fbc..f0fe39bc 100644 --- a/jupyterhub/orm.py +++ b/jupyterhub/orm.py @@ -135,16 +135,6 @@ class User(Base): id = Column(Integer, primary_key=True, autoincrement=True) name = Column(Unicode(255), unique=True) - # properties on the spawner wrapper - # some APIs get these low-level objects - # when the spawner isn't running, - # for which these should all be False - active = running = ready = False - pending = None - @property - def orm_spawner(self): - return self - _orm_spawners = relationship( "Spawner", backref="user", @@ -219,6 +209,15 @@ class Spawner(Base): started = Column(DateTime) last_activity = Column(DateTime, nullable=True) + # properties on the spawner wrapper + # some APIs get these low-level objects + # when the spawner isn't running, + # for which these should all be False + active = running = ready = False + pending = None + @property + def orm_spawner(self): + return self class Service(Base): """A service run with JupyterHub