[Zope-Checkins] SVN: Zope/trunk/ - Collector #1124: The ZReST product now uses the same reST encoding

Andreas Jung andreas at andreas-jung.com
Thu May 13 10:53:16 EDT 2004


Log message for revision 24624:
     - Collector #1124: The ZReST product now uses the same reST encoding
       parameters from zope.conf as the low-level reStructuredText
       implementation.



-=-
Modified: Zope/trunk/doc/CHANGES.txt
===================================================================
--- Zope/trunk/doc/CHANGES.txt	2004-05-13 14:09:08 UTC (rev 24623)
+++ Zope/trunk/doc/CHANGES.txt	2004-05-13 14:53:16 UTC (rev 24624)
@@ -109,6 +109,10 @@
 
     Bugs fixed
 
+     - Collector #1124: The ZReST product now uses the same reST encoding
+       parameters from zope.conf as the low-level reStructuredText
+       implementation.
+
      - Collector #1259: removed the "uninstall" target from the Makefile
        since the uninstall routine could also remove non-Zope files. Because
        this was to dangerous it has been removed completely. 

Modified: Zope/trunk/lib/python/Products/ZReST/ZReST.py
===================================================================
--- Zope/trunk/lib/python/Products/ZReST/ZReST.py	2004-05-13 14:09:08 UTC (rev 24623)
+++ Zope/trunk/lib/python/Products/ZReST/ZReST.py	2004-05-13 14:53:16 UTC (rev 24624)
@@ -18,9 +18,15 @@
 from AccessControl import ClassSecurityInfo
 from AccessControl import ModuleSecurityInfo
 from DateTime.DateTime import DateTime
+from App.config import getConfiguration 
 import sys
 modulesecurity = ModuleSecurityInfo()
 
+
+default_enc = sys.getdefaultencoding()
+default_output_encoding = getConfiguration().rest_output_encoding or default_enc
+default_input_encoding = getConfiguration().rest_input_encoding or default_enc
+
 modulesecurity.declareProtected('View management screens',
     'manage_addZReSTForm')
 manage_addZReSTForm = DTMLFile('dtml/manage_addZReSTForm', globals())
@@ -47,22 +53,23 @@
     meta_type =  'ReStructuredText Document'
     security = ClassSecurityInfo()
 
-    def __init__(self, id):
+    def __init__(self, id,output_encoding=default_output_encoding,
+                 input_encoding=default_input_encoding):
         self.id = id
         self.title = id
         self.stylesheet = 'default.css'
         self.report_level = '2'
         self.source = self.formatted = ''
-        self.input_encoding = 'iso-8859-15'
-        self.output_encoding = 'iso-8859-15'
+        self.input_encoding = input_encoding
+        self.output_encoding = output_encoding
 
     # define the properties that define this object
     _properties = (
         {'id':'stylesheet', 'type': 'string', 'mode': 'w',
             'default': 'default.css'},
         {'id':'report_level', 'type': 'string', 'mode': 'w', 'default': '2'},
-        {'id':'input_encoding', 'type': 'string', 'mode': 'w', 'default': 'iso-8859-15'},
-        {'id':'output_encoding', 'type': 'string', 'mode': 'w', 'default': 'iso-8859-15'},
+        {'id':'input_encoding', 'type': 'string', 'mode': 'w', 'default': default_input_encoding},
+        {'id':'output_encoding', 'type': 'string', 'mode': 'w', 'default': default_output_encoding},
     )
     property_extensible_schema__ = 0
 




More information about the Zope-Checkins mailing list