Fix 0 port value being overriden by default
By explicitly comparing port value with None, instead of using its bool() value.
This commit is contained in:
parent
05102f63b8
commit
e1cc16f8be
3 changed files with 14 additions and 8 deletions
|
|
@ -972,7 +972,8 @@ class Flask(_PackageBoundObject):
|
|||
sn_host, _, sn_port = server_name.partition(":")
|
||||
|
||||
host = host or sn_host or _host
|
||||
port = int(port or sn_port or _port)
|
||||
# pick the first value that's not None (0 is allowed)
|
||||
port = int(next((p for p in (port, sn_port) if p is not None), _port))
|
||||
|
||||
options.setdefault("use_reloader", self.debug)
|
||||
options.setdefault("use_debugger", self.debug)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue