From 42a993fd084780ad23e475f27f67ade3ae68d801 Mon Sep 17 00:00:00 2001 From: Min RK Date: Thu, 8 Sep 2016 16:54:52 +0200 Subject: [PATCH] backward-combat for ip, port in LocalProcessSpawner subclasses Subclasses prior to 0.6 may assume return value of LocalProcessSpawner.start can be ignored instead of passing it through. For these cases, keep setting ip/port in the deprecated way so that it still works with a warning, rather than failing with the wrong port. --- jupyterhub/spawner.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/jupyterhub/spawner.py b/jupyterhub/spawner.py index 0ff15d16..65d0dd31 100644 --- a/jupyterhub/spawner.py +++ b/jupyterhub/spawner.py @@ -495,6 +495,16 @@ class LocalProcessSpawner(Spawner): raise self.pid = self.proc.pid + + if self.__class__ is not LocalProcessSpawner: + # subclasses may not pass through return value of super().start, + # relying on deprecated 0.6 way of setting ip, port, + # so keep a redundant copy here for now. + # A deprecation warning will be shown if the subclass + # does not return ip, port. + if self.ip: + self.user.server.ip = self.ip + self.user.server.port = self.port return (self.ip or '127.0.0.1', self.port) @gen.coroutine