Mercurial > moin > 1.9
changeset 86:5181bcd3feb5
Show a better error message if PyXML is not installed and the docbook formatter is used.
imported from: moin--main--1.5--patch-88
author | Alexander Schremmer <alex@alexanderweb.de.tla> |
---|---|
date | Fri, 07 Oct 2005 08:55:45 +0000 |
parents | 4d6a7cb1f441 |
children | ee1c9e86b393 |
files | MoinMoin/formatter/xml_docbook.py |
diffstat | 1 files changed, 12 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/MoinMoin/formatter/xml_docbook.py Thu Oct 06 19:57:24 2005 +0000 +++ b/MoinMoin/formatter/xml_docbook.py Fri Oct 07 08:55:45 2005 +0000 @@ -13,7 +13,17 @@ from MoinMoin.formatter.base import FormatterBase from MoinMoin import wikiutil, i18n, config +from MoinMoin.error import CompositeError + from xml.sax import saxutils +from xml.dom import getDOMImplementation + +class InternalError(CompositeError): pass + +try: + dom = getDOMImplementation("4DOM") +except ImportError: + raise InternalError("You need to install PyXML to use the DocBook formatter.") class DocBookOutputFormatter: """ @@ -84,8 +94,7 @@ def __init__(self, request, **kw): '''We should use this for creating the doc''' FormatterBase.__init__(self, request, **kw) - from xml.dom import getDOMImplementation - dom = getDOMImplementation("4DOM") + self.doc = dom.createDocument(None, "article", dom.createDocumentType( "article", "-//OASIS//DTD DocBook V4.4//EN", "http://www.docbook.org/xml/4.4/docbookx.dtd")) @@ -435,7 +444,7 @@ if attrs and attrs.has_key('id'): sanitized_attrs[id] = attrs['id'] return self._handleNode("row", on, sanitized_attrs) - + def table_cell(self, on, attrs=None): # Finish row definition sanitized_attrs = []