mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
Allow string values to be None.
This commit is contained in:
parent
38a1448a9c
commit
ce5527d682
@ -181,6 +181,8 @@ def validate_pos_int(val):
|
|||||||
return val
|
return val
|
||||||
|
|
||||||
def validate_string(val):
|
def validate_string(val):
|
||||||
|
if val is None:
|
||||||
|
return None
|
||||||
if not isinstance(val, basestring):
|
if not isinstance(val, basestring):
|
||||||
raise TypeError("Not a string: %s" % val)
|
raise TypeError("Not a string: %s" % val)
|
||||||
return val.strip()
|
return val.strip()
|
||||||
@ -381,6 +383,7 @@ with Setting("pidfile") as s:
|
|||||||
s.cli = ["-p", "--pid"]
|
s.cli = ["-p", "--pid"]
|
||||||
s.meta = "FILE"
|
s.meta = "FILE"
|
||||||
s.validator = validate_string
|
s.validator = validate_string
|
||||||
|
s.default = None
|
||||||
s.fmt_desc("""\
|
s.fmt_desc("""\
|
||||||
A filename to use for the PID file.
|
A filename to use for the PID file.
|
||||||
|
|
||||||
@ -391,6 +394,7 @@ with Setting("user") as s:
|
|||||||
s.section = "Server Mechanics"
|
s.section = "Server Mechanics"
|
||||||
s.cli = ["-u", "--user"]
|
s.cli = ["-u", "--user"]
|
||||||
s.validator = validate_string
|
s.validator = validate_string
|
||||||
|
s.default = None
|
||||||
s.fmt_desc("""\
|
s.fmt_desc("""\
|
||||||
Switch worker processes to run as this user.
|
Switch worker processes to run as this user.
|
||||||
|
|
||||||
@ -403,6 +407,7 @@ with Setting("group") as s:
|
|||||||
s.section = "Server Mechanics"
|
s.section = "Server Mechanics"
|
||||||
s.cli = ["-g", "--group"]
|
s.cli = ["-g", "--group"]
|
||||||
s.validator = validate_string
|
s.validator = validate_string
|
||||||
|
s.default = None
|
||||||
s.fmt_desc("""\
|
s.fmt_desc("""\
|
||||||
Switch worker process to run as this group.
|
Switch worker process to run as this group.
|
||||||
|
|
||||||
@ -432,6 +437,7 @@ with Setting("tmp_upload_dir") as s:
|
|||||||
s.section = "Server Mechanics"
|
s.section = "Server Mechanics"
|
||||||
s.meta = "DIR"
|
s.meta = "DIR"
|
||||||
s.validator = validate_string
|
s.validator = validate_string
|
||||||
|
s.default = None
|
||||||
s.fmt_desc("""\
|
s.fmt_desc("""\
|
||||||
Directory to store temporary request data as they are read.
|
Directory to store temporary request data as they are read.
|
||||||
|
|
||||||
@ -524,6 +530,19 @@ with Setting("post_fork") as s:
|
|||||||
new Worker.
|
new Worker.
|
||||||
""")
|
""")
|
||||||
|
|
||||||
|
with Setting("when_ready") as s:
|
||||||
|
s.section = "Server Hooks"
|
||||||
|
s.validator = validate_callable(1)
|
||||||
|
s.type = "callable"
|
||||||
|
def def_start_server(server):
|
||||||
|
pass
|
||||||
|
s.default = def_start_server
|
||||||
|
s.fmt_desc("""\
|
||||||
|
Called just after the server is started.
|
||||||
|
|
||||||
|
The callable needs to accept a single instance variable for the Arbiter.
|
||||||
|
""")
|
||||||
|
|
||||||
with Setting("pre_exec") as s:
|
with Setting("pre_exec") as s:
|
||||||
s.section = "Server Hooks"
|
s.section = "Server Hooks"
|
||||||
s.validator = validate_callable(1)
|
s.validator = validate_callable(1)
|
||||||
@ -537,16 +556,3 @@ with Setting("pre_exec") as s:
|
|||||||
The callable needs to accept a single instance variable for the Arbiter.
|
The callable needs to accept a single instance variable for the Arbiter.
|
||||||
""")
|
""")
|
||||||
|
|
||||||
|
|
||||||
with Setting("when_ready") as s:
|
|
||||||
s.section = "Server Hooks"
|
|
||||||
s.validator = validate_callable(1)
|
|
||||||
s.type = "callable"
|
|
||||||
def def_start_server(server):
|
|
||||||
pass
|
|
||||||
s.default = def_start_server
|
|
||||||
s.fmt_desc("""\
|
|
||||||
Called just after the server is started
|
|
||||||
|
|
||||||
The callable needs to accept a single instance variable for the Arbiter.
|
|
||||||
""")
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user