changeset 1356:25a7e9e2b9b7

use polyglot writer, require emeraldtree >= 0.9.1 removed workaround made for the xmlwriter we used previously,
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sun, 20 May 2012 03:59:08 +0200
parents edc174ee4adc
children 895bc6e84918
files MoinMoin/items/__init__.py setup.py
diffstat 2 files changed, 7 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/items/__init__.py	Sun May 13 22:05:23 2012 +0200
+++ b/MoinMoin/items/__init__.py	Sun May 20 03:59:08 2012 +0200
@@ -134,10 +134,10 @@
 item_registry = RegistryItem()
 
 
-def conv_serialize(doc, namespaces):
+def conv_serialize(doc, namespaces, method='polyglot'):
     out = array('u')
     flaskg.clock.start('conv_serialize')
-    doc.write(out.fromunicode, namespaces=namespaces, method='xml')
+    doc.write(out.fromunicode, namespaces=namespaces, method=method)
     out = out.tounicode()
     flaskg.clock.stop('conv_serialize')
     return out
@@ -288,13 +288,7 @@
         doc = html_conv(doc)
         flaskg.clock.stop('conv_dom_html')
         rendered_data = conv_serialize(doc, {html.namespace: ''})
-        # This is a work-around to avoid the invalid <div /> tag from being passed
-        # and causing layout issues in many browsers
-        # Instead, send a <div></div> tag which is valid according to the HTML spec
-        # The wider issue with serialization is covered here:
-        # https://bitbucket.org/thomaswaldmann/moin-2.0/issue/145/xml-mode-serialization-returns-self
-        return "<div></div>" if rendered_data == "<div xmlns=\"http://www.w3.org/1999/xhtml\" />" \
-                             else rendered_data
+        return rendered_data
 
     def _render_data_xml(self):
         doc = self.internal_representation()
@@ -302,7 +296,8 @@
                               {moin_page.namespace: '',
                                xlink.namespace: 'xlink',
                                html.namespace: 'html',
-                               })
+                              },
+                              'xml')
 
     def _render_data_highlight(self):
         # override this in child classes
--- a/setup.py	Sun May 13 22:05:23 2012 +0200
+++ b/setup.py	Sun May 20 03:59:08 2012 +0200
@@ -77,6 +77,7 @@
         'https://bitbucket.org/thomaswaldmann/whoosh/get/2.4x.tar.gz#egg=Whoosh-2.4.99dev',
         # fixed flask-themes, 0.1.3 does not work for flask 0.8.x, thus we use a faked 0.1.3.1:
         'https://bitbucket.org/thomaswaldmann/flask-themes/get/24dcc703953f.tar.gz#egg=Flask-Themes-0.1.3.1',
+        'https://bitbucket.org/thomaswaldmann/emeraldtree/get/tip.tar.gz#egg=emeraldtree-0.9.1',
     ],
     install_requires=[
         'blinker>=1.1', # event signalling (e.g. for change notification trigger)
@@ -86,7 +87,7 @@
         'Flask-Cache>=0.3.4', # caching support
         'Flask-Script>=0.3.3', # scripting support
         'Flask-Themes>=0.1.3.1', # theme support
-        'emeraldtree>=0.9.0', # xml processing
+        'emeraldtree>=0.9.1', # xml processing
         'flatland==dev', # repo checkout at revision 269:6c5d262d7eff works
         'Jinja2>=2.6', # template engine
         'pygments>=1.4', # src code / text file highlighting