Commit 0e815c9c authored by Chris McDonough's avatar Chris McDonough

- The ReST input and output encodings are now configured via the

       'rest-input-encoding' and 'rest-output-encoding' config file
       directives rather than the REST_INPUT_ENCODING and
       REST_OUTPUT_ENCODING environment variables.

     - Datetime-format settings are now configured via the
       'datetime-format' configuration file directive rather than the
       DATETIME_FORMAT environment variable.

     - Trusted proxies are now configured via the 'trusted-proxy'
       configuration file directive rather than the
       ZOPE_TRUSTED_PROXIES environment variable.
parent 9b2b00d9
......@@ -8,6 +8,19 @@ Zope Changes
Features added
- The ReST input and output encodings are now configured via the
'rest-input-encoding' and 'rest-output-encoding' config file
directives rather than the REST_INPUT_ENCODING and
REST_OUTPUT_ENCODING environment variables.
- Datetime-format settings are now configured via the
'datetime-format' configuration file directive rather than the
DATETIME_FORMAT environment variable.
- Trusted proxies are now configured via the 'trusted-proxy'
configuration file directive rather than the
ZOPE_TRUSTED_PROXIES environment variable.
- The maximum number of sockets that ZServer will open in order to
service incoming connections can now be specified via the
max-listen-sockets conf file parameter.
......
......@@ -24,7 +24,16 @@ def security_policy_implementation(value):
ok = ('PYTHON', 'C')
if value not in ok:
raise ValueError, (
"security_policy_implementation must be one of %s" % ok
"security-policy-implementation must be one of %s" % repr(ok)
)
return value
def datetime_format(value):
value = value.lower()
ok = ('us', 'international')
if value not in ok:
raise ValueError, (
"datetime-format must be one of %r" % repr(ok)
)
return value
......
......@@ -28,6 +28,10 @@ def locale(value):
locale.setlocale(locale.LC_ALL, value)
return value
def datetime_format(value):
value and _setenv('DATETIME_FORMAT', value)
return value
def zserver_read_only_mode(value):
value and _setenv('ZOPE_READ_ONLY', '1')
return value
......@@ -86,6 +90,14 @@ def structured_text_header_level(value):
value is not None and _setenv('STX_DEFAULT_LEVEL', value)
return value
def rest_input_encoding(value):
value and _setenv('REST_INPUT_ENCODING' , value)
return value
def rest_output_encoding(value):
value and _setenv('REST_OUTPUT_ENCODING' , value)
return value
def maximum_security_manager_stack_size(value):
value is not None and _setenv('Z_MAX_STACK_SIZE', value)
return value
......@@ -138,6 +150,10 @@ def root_handler(config):
config.cgi_environment,
config.port_base)
# set up trusted proxies
if config.trusted_proxies:
import ZPublisher.HTTPRequest
ZPublisher.HTTPRequest.trusted_proxies = tuple(config.trusted_proxies)
class _DummyServerConfig:
class _Thing:
......
......@@ -237,7 +237,7 @@
If you intend to run Zope as the "root" user, you must supply this
directive with an effective username or userid number to which Zope
will 'suid' after the server ports are bound. This directive only
works under UNIX and if Zope is started as the root user.
has effect under UNIX and if Zope is started as the root user.
</description>
<metadefault>unset</metadefault>
</key>
......@@ -268,6 +268,19 @@
<metadefault>unset</metadefault>
</key>
<key name="datetime-format" datatype=".datetime_format"
handler="datetime_format" default="us">
<description>
Set this variable either to "us" or "international" to force the
DateTime module to parse date strings either with
month-before-days-before-year ("us") or
days-before-month-before-year ("international"). The default
behaviour of DateTime (when this setting is left unset) is to
parse dates as US dates.
</description>
<metadefault>us</metadefault>
</key>
<key name="zserver-threads" datatype="integer" default="4">
<description>
Specify the number of threads that Zope's ZServer web server will use
......@@ -316,6 +329,24 @@
<metadefault>3</metadefault>
</key>
<key name="rest-input-encoding" handler="rest_input_encoding">
<description>
Specifies the input encoding of re-StructuredText documents
(e.g. 'utf-8', 'iso-8859' or any other valid encoding recognized
by Python). The default is your Python's default encoding.
</description>
<metadefault>unset</metadefault>
</key>
<key name="rest-output-encoding" handler="rest_output_encoding">
<description>
Specifies the output encoding of re-StructuredText documents
(e.g. 'utf-8', 'iso-8859' or any other valid encoding recognized
by Python). The default is your Python's default encoding.
</description>
<metadefault>unset</metadefault>
</key>
<key name="maximum-security-manager-stack-size" datatype="integer"
default="100" handler="maximum_security_manager_stack_size">
<description>
......@@ -384,6 +415,17 @@
<metadefault>on</metadefault>
</key>
<multikey name="trusted-proxy" datatype="ipaddr-or-hostname"
attribute="trusted_proxies">
<description>
Define one or more 'trusted-proxies' keys, each of which is a
hostname or an IP address. The set of definitions comprises a list
of front-end proxies that are trusted to supply an accurate
X_FORWARDED_FOR header to Zope (security-related).
</description>
<metadefault>unset</metadefault>
</multikey>
<key name="security-policy-implementation"
datatype=".security_policy_implementation"
default="C" handler="security_policy_implementation">
......@@ -527,7 +569,6 @@
</description>
</section>
<section type="logger" name="trace">
<description>
Describes the logging performed to capture the 'trace log,
......@@ -536,6 +577,17 @@
</description>
</section>
<!-- max-listen-sockets should really go into the ZServer package, but
I can't quite figure out how to put it there -->
<key name="max-listen-sockets" datatype="integer"
handler="max_listen_sockets" default="1000">
<description>
The maximum number of sockets that ZServer will attempt to open
in order to service incoming connections.
</description>
</key>
<multisection type="ZServer.server" name="*" attribute="servers"/>
<key name="port-base" datatype="integer" default="0">
<description>
......@@ -558,15 +610,5 @@
<section type="zoperunner" name="*" attribute="runner"/>
<!-- the below should go into the ZServer package, but I can't quite
figure out how to put it there -->
<key name="max-listen-sockets" datatype="integer"
handler="max_listen_sockets" default="1000">
<description>
The maximum number of sockets that ZServer will attempt to open
in order to service incoming connections.
</description>
</key>
</schema>
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment