comment review

This commit is contained in:
Min RK
2016-12-20 16:41:26 +01:00
parent 72ab8f99ec
commit 3b3bc8224b
2 changed files with 8 additions and 3 deletions

View File

@@ -235,7 +235,7 @@ class User(HasTraits):
# Handle < 0.7 behavior with a warning, assuming info was stored in db by the Spawner.
self.log.warning("DEPRECATION: Spawner.start should return (ip, port) in JupyterHub >= 0.7")
if spawner.api_token != api_token:
# Spawner re-used an API token, discard the one we just created
# Spawner re-used an API token, discard the unused api_token
orm_token = orm.APIToken.find(self.db, api_token)
if orm_token is not None:
self.db.delete(orm_token)
@@ -321,6 +321,8 @@ class User(HasTraits):
self.db.delete(self.server)
self.server = None
if not spawner.will_resume:
# find and remove the API token if the spawner isn't
# going to re-use it next time
orm_token = orm.APIToken.find(self.db, api_token)
if orm_token:
self.db.delete(orm_token)