[Zope3-checkins] SVN: Zope3/trunk/src/zope/app/renderer/rest.py added optional parameter to the render method to allow overriding of the

Jodok Batlogg jodok.batlogg at lovelysystems.com
Wed Jan 10 05:17:01 EST 2007


Log message for revision 71853:
  added optional parameter to the render method to allow overriding of the 
  default settings for rendering rest files.
  right now render returns html that includes two times H1 which doesn't
  fit for a lot of use-cases
  

Changed:
  U   Zope3/trunk/src/zope/app/renderer/rest.py

-=-
Modified: Zope3/trunk/src/zope/app/renderer/rest.py
===================================================================
--- Zope3/trunk/src/zope/app/renderer/rest.py	2007-01-10 09:37:44 UTC (rev 71852)
+++ Zope3/trunk/src/zope/app/renderer/rest.py	2007-01-10 10:16:55 UTC (rev 71853)
@@ -86,7 +86,7 @@
     implements(IHTMLRenderer)
     __used_for__ = IReStructuredTextSource
 
-    def render(self):
+    def render(self, settings_overrides=None):
         r"""See zope.app.interfaces.renderer.IHTMLRenderer
 
         Let's make sure that inputted unicode stays as unicode:
@@ -95,12 +95,15 @@
         >>> renderer.render()
         u'<p>b\xc3h</p>\n'
         """
-        settings_overrides = {
-            'halt_level': 6,
-            'input_encoding': 'unicode',
-            'output_encoding': 'unicode',
-            'initial_header_level': 3
-            }
+        if settings_overrides is None:
+            # default settings for the renderer
+            settings_overrides = {
+                'halt_level': 6,
+                'input_encoding': 'unicode',
+                'output_encoding': 'unicode',
+                'initial_header_level': 3,
+                }
+
         writer = Writer()
         writer.translator_class = ZopeTranslator
         html = docutils.core.publish_string(



More information about the Zope3-Checkins mailing list