[FIX] core: werkzeug 0.12 compatibility

Since werkzeug 0.12, the `BaseWSGIServer.__init__` method expect the
socket to be bound to determine the effective port it listen to [1].
Stop pretend to bind the socket and close it directly after use.

[1] see pallets/werkzeug@1fc28cbb30
This commit is contained in:
Christophe Simonis 2017-07-27 13:40:19 +02:00
parent 48c478513f
commit e6b91eb55a
1 changed files with 3 additions and 4 deletions

View File

@ -66,12 +66,11 @@ class BaseWSGIServerNoBind(LoggingBaseWSGIServerMixIn, werkzeug.serving.BaseWSGI
use this class, sets the socket and calls the process_request() manually
"""
def __init__(self, app):
werkzeug.serving.BaseWSGIServer.__init__(self, "1", "1", app)
def server_bind(self):
# we dont bind beause we use the listen socket of PreforkServer#socket
# instead we close the socket
werkzeug.serving.BaseWSGIServer.__init__(self, "127.0.0.1", 0, app)
# Directly close the socket. It will be replaced by WorkerHTTP when processing requests
if self.socket:
self.socket.close()
def server_activate(self):
# dont listen as we use PreforkServer#socket
pass