comparison MoinMoin/items/__init__.py @ 197:19e92e1ff286

fix the +dom view, details below As we use autoescape now, we need to use Markup() class to give xml into the template. Removed converters argument when calling internal_representation(), use default. Remove unneeded import.
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Fri, 29 Apr 2011 21:14:35 +0200
parents 17693a043442
children 9ffa82e550ba
comparison
equal deleted inserted replaced
196:1b3dec65779e 197:19e92e1ff286
158 return '' 158 return ''
159 159
160 def feed_input_conv(self): 160 def feed_input_conv(self):
161 return self.name 161 return self.name
162 162
163 def internal_representation(self, converters=['smiley', 'link']): 163 def internal_representation(self, converters=['smiley']):
164 """ 164 """
165 Return the internal representation of a document using a DOM Tree 165 Return the internal representation of a document using a DOM Tree
166 """ 166 """
167 flaskg.clock.start('conv_in_dom') 167 flaskg.clock.start('conv_in_dom')
168 hash_name = HASH_ALGORITHM 168 hash_name = HASH_ALGORITHM
180 # FROM_mimetype --> DOM 180 # FROM_mimetype --> DOM
181 # if so we perform the transformation, otherwise we don't 181 # if so we perform the transformation, otherwise we don't
182 from MoinMoin.converter import default_registry as reg 182 from MoinMoin.converter import default_registry as reg
183 from MoinMoin.util.iri import Iri 183 from MoinMoin.util.iri import Iri
184 from MoinMoin.util.mime import Type, type_moin_document 184 from MoinMoin.util.mime import Type, type_moin_document
185 from MoinMoin.util.tree import moin_page, xlink 185 from MoinMoin.util.tree import moin_page
186 input_conv = reg.get(Type(self.mimetype), type_moin_document) 186 input_conv = reg.get(Type(self.mimetype), type_moin_document)
187 if not input_conv: 187 if not input_conv:
188 raise TypeError("We cannot handle the conversion from %s to the DOM tree" % self.mimetype) 188 raise TypeError("We cannot handle the conversion from %s to the DOM tree" % self.mimetype)
189 smiley_conv = reg.get(type_moin_document, type_moin_document, 189 smiley_conv = reg.get(type_moin_document, type_moin_document,
190 icon='smiley') 190 icon='smiley')
245 doc.write(out.fromunicode, namespaces={html.namespace: ''}, method='xml') 245 doc.write(out.fromunicode, namespaces={html.namespace: ''}, method='xml')
246 out = out.tounicode() 246 out = out.tounicode()
247 flaskg.clock.stop('conv_serialize') 247 flaskg.clock.stop('conv_serialize')
248 return out 248 return out
249 249
250 def _render_data_xml(self, converters): 250 def _render_data_xml(self):
251 from MoinMoin.util.tree import moin_page, xlink, html 251 from MoinMoin.util.tree import moin_page, xlink, html
252 doc = self.internal_representation(converters) 252 doc = self.internal_representation()
253 253
254 from array import array 254 from array import array
255 out = array('u') 255 out = array('u')
256 doc.write(out.fromunicode, 256 doc.write(out.fromunicode,
257 namespaces={moin_page.namespace: '', 257 namespaces={moin_page.namespace: '',