This change allows FTPHandler to inherit a concrete IOLoop class from FTPServer. Without it, it makes customizing an IOLoop harder than it needs to be: any custom IOLoop passed to FTPServer does not get inherited by handlers right now, because of this (_SpawnerBase in servers.py):
def _loop(self, handler):
"""Serve handler's IO loop in a separate thread or process."""
with IOLoop() as ioloop:
Other approaches
This looks ugly and makes assumptions about the constuctor:
def _loop(self, handler):
"""Serve handler's IO loop in a separate thread or process."""
- with IOLoop() as ioloop:
+ with self.ioloop.__class__() as ioloop:
Another one is to introduce a new FTPServer argument ioloop_factory - a callable factory.
def _loop(self, handler):
"""Serve handler's IO loop in a separate thread or process."""
- with IOLoop() as ioloop:
+ with self.ioloop_factory() as ioloop:
This change allows
FTPHandler
to inherit a concreteIOLoop
class fromFTPServer
. Without it, it makes customizing an IOLoop harder than it needs to be: any custom IOLoop passed toFTPServer
does not get inherited by handlers right now, because of this (_SpawnerBase
inservers.py
):Other approaches
This looks ugly and makes assumptions about the constuctor:
Another one is to introduce a new
FTPServer
argumentioloop_factory
- a callable factory.Tests
Linux, Python 3.10.12.