[Zope-Checkins] CVS: Zope/lib/python/Products/ZReST - ZReST.py:1.6.12.5

Andreas Jung andreas at andreas-jung.com
Thu May 13 10:54:52 EDT 2004


Update of /cvs-repository/Zope/lib/python/Products/ZReST
In directory cvs.zope.org:/tmp/cvs-serv17392/lib/python/Products/ZReST

Modified Files:
      Tag: Zope-2_7-branch
	ZReST.py 
Log Message:

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


=== Zope/lib/python/Products/ZReST/ZReST.py 1.6.12.4 => 1.6.12.5 ===
--- Zope/lib/python/Products/ZReST/ZReST.py:1.6.12.4	Tue Nov  4 12:31:38 2003
+++ Zope/lib/python/Products/ZReST/ZReST.py	Thu May 13 10:54:49 2004
@@ -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
 
@@ -91,7 +98,7 @@
         return self.source
 
     # edit form, which is also the primary interface
-    security.declareProtected('Edit ReStructuredText', 'manage_editForm')
+    security.declareProtected('Edit ReStructuredText', 'manage_main')
     manage_main = DTMLFile('dtml/manage_editForm', globals())
 
     # edit action




More information about the Zope-Checkins mailing list