Empty "source" elements break the XSLT renderer

Bug #101494 reported by Clemens Robbenhaar on 2005-09-05
Affects Status Importance Assigned to Milestone
Eric Casteleijn

Bug Description

In case someone adds an "external source" without actually selecting an id
(for example because no external sources are defined here),
the widget based renderer produces some reasonable error message
in the public view, like:

[external source element is broken]
error message: 'NoneType' object has no attribute 'to_html'

The XSLT based renderes however barfs about it completely,
causing the error page to show up. It would be nice if that renderer
would behave similar, e.g. just displaying an error inline to the source.

Exception from the log file reads:

   File "SOFTWARE_ROOT/Products/Silva/SilvaObject.py", line 306, in preview
     return self.view_version('preview', content)
   File "SOFTWARE_ROOT/Products/Silva/SilvaObject.py", line 335, in view_version
     result = getRenderableAdapter(version).view()
   File "SOFTWARE_ROOT/Products/Silva/adapters/renderable.py", line 20, in view
     return unicode(renderer.render(self.context), 'UTF-8')
   File "SOFTWARE_ROOT/Products/Silva/transform/renderer/xsltrendererbase.py", line 70, in render
     source_xml = source.getXML()
   File "SOFTWARE_ROOT/Products/Silva/adapters/xmlsource.py", line 17, in getXML
     return exporter.exportToString(exportRoot, settings, info)
   File "SOFTWARE_ROOT/Sprout/src/sprout/saxext/xmlexport.py", line 111, in exportToString
     self.exportToFile(obj, f, settings, info)
   File "SOFTWARE_ROOT/Sprout/src/sprout/saxext/xmlexport.py", line 100, in exportToFile
     self.exportToSax(obj, handler, settings, info)
   File "SOFTWARE_ROOT/Sprout/src/sprout/saxext/xmlexport.py", line 88, in exportToSax
     self._getProducer(obj, handler, settings, info).sax()
   File "SOFTWARE_ROOT/Products/Silva/silvaxml/xmlexport.py", line 376, in sax
   File "SOFTWARE_ROOT//Sprout/src/sprout/saxext/xmlexport.py", line 235, in subsax
   File "SOFTWARE_ROOT/Products/SilvaDocument/silvaxml/xmlexport.py", line 35, in sax
   File "SOFTWARE_ROOT/Products/SilvaDocument/silvaxml/xmlexport.py", line 61, in sax_node
   File "SOFTWARE_ROOT/Products/SilvaDocument/silvaxml/xmlexport.py", line 47, in sax_node
     self.sax_source(node, attributes['id'])
KeyError: 'id'

Andy Altepeter (aaltepet) wrote :

I've reworked sax_source to emulate the error reporting of the widgets renderer. Also, changed the html code for the widgets errors from <b> to <strong>.

Changed in silva:
assignee: nobody → thisfred
status: New → Fix Committed
Changed in silva:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers