[Zope-Checkins] CVS: Zope/lib/python/Zope/Startup - datatypes.py:1.11 handlers.py:1.8 zopeschema.xml:1.14

Chris McDonough chrism@zope.com
Sun, 20 Jul 2003 22:21:10 -0400


Update of /cvs-repository/Zope/lib/python/Zope/Startup
In directory cvs.zope.org:/tmp/cvs-serv5660/lib/python/Zope/Startup

Modified Files:
	datatypes.py handlers.py zopeschema.xml 
Log Message:
     - 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.




=== Zope/lib/python/Zope/Startup/datatypes.py 1.10 => 1.11 ===
--- Zope/lib/python/Zope/Startup/datatypes.py:1.10	Sun Jul 20 12:22:00 2003
+++ Zope/lib/python/Zope/Startup/datatypes.py	Sun Jul 20 22:21:03 2003
@@ -24,7 +24,16 @@
     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
 


=== Zope/lib/python/Zope/Startup/handlers.py 1.7 => 1.8 ===
--- Zope/lib/python/Zope/Startup/handlers.py:1.7	Sat Jul 19 23:52:19 2003
+++ Zope/lib/python/Zope/Startup/handlers.py	Sun Jul 20 22:21:03 2003
@@ -28,6 +28,10 @@
     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 @@
     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 @@
                         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:


=== Zope/lib/python/Zope/Startup/zopeschema.xml 1.13 => 1.14 ===
--- Zope/lib/python/Zope/Startup/zopeschema.xml:1.13	Sun Jul 20 12:22:00 2003
+++ Zope/lib/python/Zope/Startup/zopeschema.xml	Sun Jul 20 22:21:03 2003
@@ -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>