[z3-checkins] r27355 - z3/www/trunk

regebro at codespeak.net regebro at codespeak.net
Wed May 17 14:32:52 CEST 2006


Author: regebro
Date: Wed May 17 14:32:51 2006
New Revision: 27355

Modified:
   z3/www/trunk/mkwebsite.py
   z3/www/trunk/publish.py
Log:
Added the possibility to specify decoding for some pages.
I think this is needed for newer versions of docutils.


Modified: z3/www/trunk/mkwebsite.py
==============================================================================
--- z3/www/trunk/mkwebsite.py	(original)
+++ z3/www/trunk/mkwebsite.py	Wed May 17 14:32:51 2006
@@ -85,8 +85,8 @@
 
     site.registerPages(
         [
-        publish.FileRstPage('text/index.txt'),
-        publish.FileRstPage('text/submission_guidelines.txt'),
+        publish.FileRstPage('text/index.txt', encoding='ascii'),
+        publish.FileRstPage('text/submission_guidelines.txt', encoding='ascii'),
         ],
         site.getRootLayouter(),
         '.',

Modified: z3/www/trunk/publish.py
==============================================================================
--- z3/www/trunk/publish.py	(original)
+++ z3/www/trunk/publish.py	Wed May 17 14:32:51 2006
@@ -63,6 +63,7 @@
     def save(self):
         """Save this resource.
         """
+        print "Saving", self._destination_path
         try:
             os.makedirs(os.path.dirname(self._destination_path))
         except os.error:
@@ -124,14 +125,19 @@
         return layouter.render(**kw)
 
 class RstPage(BasePage):
+    def __init__(self, data_source, name=None, encoding='ascii'):
+        BasePage.__init__(self, data_source, name=name)
+        self.encoding = encoding
+
     def getData(self):
-        return html_parts(self._data, initial_header_level=2)
+        return html_parts(self._data, initial_header_level=2, 
+                          input_encoding=self.encoding)
 
 class FileRstPage(RstPage):
     """Convenience way to create a RstPage from file.
     """
-    def __init__(self, path, name=None):
-        RstPage.__init__(self, PathSource(path), name)
+    def __init__(self, path, name=None, encoding='unicode'):
+        RstPage.__init__(self, PathSource(path), name, encoding=encoding)
         
 class SimplePage(BasePage):
     def __init__(self, name):


More information about the z3-checkins mailing list