changeset 48:8a37de5a6b79

fixed broken tests package, moved ConvertError to convert module imported from: moin--main--1.5--patch-49
author Nir Soffer <nirs@freeshell.org>
date Wed, 28 Sep 2005 23:09:56 +0000
parents c4ebf23213a8
children cf52f97a5857
files MoinMoin/_tests/test_converter_text_html_text_x_moin.py MoinMoin/converter/text_html_text_x_moin.py MoinMoin/error.py
diffstat 3 files changed, 20 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/_tests/test_converter_text_html_text_x_moin.py	Wed Sep 28 20:10:40 2005 +0000
+++ b/MoinMoin/_tests/test_converter_text_html_text_x_moin.py	Wed Sep 28 23:09:56 2005 +0000
@@ -8,6 +8,7 @@
 convert = converter.convert
 error = converter.ConvertError
 
+
 class BaseTestCase(unittest.TestCase):
     def do_convert_real(self, func_args, successfull = True):
         try:
--- a/MoinMoin/converter/text_html_text_x_moin.py	Wed Sep 28 20:10:40 2005 +0000
+++ b/MoinMoin/converter/text_html_text_x_moin.py	Wed Sep 28 23:09:56 2005 +0000
@@ -7,11 +7,10 @@
 
 import xml.dom.minidom
 from xml.dom import Node
-from MoinMoin import config
-from MoinMoin import wikiutil
-import MoinMoin.error
 import re, urllib
 
+from MoinMoin import config, wikiutil, error
+
 # Portions (C) International Organization for Standardization 1986
 # Permission to copy in any form is granted for use with
 # conforming SGML systems and applications as defined in
@@ -117,6 +116,11 @@
 ]>
 '''
 
+class ConvertError(error.FatalError):
+    """ Raise when html to wiki conversion fails """
+    name = "MoinMoin Convert Error"
+    
+
 class visitor(object):
     def do(self, tree):
         self.visit_node_list(tree.childNodes)
@@ -230,7 +234,7 @@
         elif name in ('ol', 'ul',):
             self.process_list(node)
         else:
-            raise MoinMoin.error.ConvertError("visit_element: Don't support %s element" % name)
+            raise ConvertError("visit_element: Don't support %s element" % name)
 
     def process_br(self, node):
             self.text.append('\n') # without this, std multi-line text below some heading misses a whitespace
@@ -266,7 +270,7 @@
                     self.text.append(":: ")
                     self.process_list_item(i)
                 else:
-                    raise MoinMoin.error.ConvertError("Illegal list element %s" % i.localName)
+                    raise ConvertError("Illegal list element %s" % i.localName)
         if self.depth == 1:
             self.text.append("\n")
         self.depth -= 1
@@ -311,7 +315,7 @@
                 elif name == 'dl':
                     self.process_dl(i)
                 else:
-                    raise MoinMoin.error.ConvertError("Illegal list element %s" % i.localName)
+                    raise ConvertError("Illegal list element %s" % i.localName)
         if self.depth == 1:
             self.text.append("\n")
         self.depth -= 1
@@ -371,7 +375,7 @@
                 elif name in ('br',):
                     self.process_br(i)
                 else:
-                    raise MoinMoin.error.ConvertError("process_blockquote: Don't support %s element" % name)
+                    raise ConvertError("process_blockquote: Don't support %s element" % name)
         self.depth -= 1
 
     def process_page(self, node):
@@ -423,7 +427,7 @@
             self.text.append(text)                          # so we just drop the header markup and keep the text
             return
         else:
-            raise MoinMoin.error.ConvertError("process_inline: Don't support %s element" % name)
+            raise ConvertError("process_inline: Don't support %s element" % name)
         
         self.text.append(command)
         for i in node.childNodes:
@@ -631,9 +635,9 @@
                     self.process_caption(node, i, style)
                     style = ''
                 else:
-                    raise MoinMoin.error.ConvertError("process_table: Don't support %s element" % name)
+                    raise ConvertError("process_table: Don't support %s element" % name)
             #else:
-            #    raise MoinMoin.error.ConvertError("Unexpected node: %r" % i)
+            #    raise ConvertError("Unexpected node: %r" % i)
         self.text.append("\n")
 
     def process_caption(self, table, node, style=""):
@@ -707,7 +711,7 @@
                     self.process_table_data(i, style=style)
                     style = ""
                 else:
-                    raise MoinMoin.error.ConvertError("process_table_record: Don't support %s element" % name)
+                    raise ConvertError("process_table_record: Don't support %s element" % name)
         self.text.append("||\n")
 
     def _unquote_url(self, url): # XXX is it necessary to have "yet another unquote function"?
@@ -746,7 +750,7 @@
                     pagename = href[len(wikiurl):].lstrip('/')
                     interwikiname = "%s:%s" % (wikitag, pagename)
                 else: 
-                    raise MoinMoin.error.ConvertError("Invalid InterWiki link: '%s'" % href)
+                    raise ConvertError("Invalid InterWiki link: '%s'" % href)
             elif class_ == "badinterwiki" and title:
                 pagename = href
                 interwikiname = "%s:%s" % (title, href)
@@ -840,12 +844,12 @@
                     return
                 else:
                     pass #print name, data, filename, alt
-            raise MoinMoin.error.ConvertError("Unknown smiley icon '%s'" % filename)
+            raise ConvertError("Unknown smiley icon '%s'" % filename)
         # Image URL
         elif src and src.startswith("http://") and wikiutil.isPicture(src):
             self.text.extend([self.white_space, src, self.white_space])
         else:
-            raise MoinMoin.error.ConvertError("Strange image src: '%s'" % src)
+            raise ConvertError("Strange image src: '%s'" % src)
 
 
 def parse(text):
@@ -854,7 +858,7 @@
     try:
         return xml.dom.minidom.parseString(text)
     except xml.parsers.expat.ExpatError, msg:
-        raise MoinMoin.error.ConvertError('ExpatError: %s' % msg)
+        raise ConvertError('ExpatError: %s' % msg)
 
 def convert(request, pagename, text):
     text = u"<page>%s</page>" % text
--- a/MoinMoin/error.py	Wed Sep 28 20:10:40 2005 +0000
+++ b/MoinMoin/error.py	Wed Sep 28 23:09:56 2005 +0000
@@ -162,9 +162,3 @@
     name = 'MoinMoin Internal Error'
 
 
-class ConvertError(FatalError):
-    """ Raise when html to wiki conversion fails
-    """
-    name = 'MoinMoin Converter Error'
-
-