changeset 3306:e50210d37a8d

catch indentation error in python parser
author Johannes Berg <johannes AT sipsolutions DOT net>
date Tue, 18 Mar 2008 19:22:01 +0100
parents dc56d314cc92
children f4212fb5ecb0
files MoinMoin/parser/text_python.py
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/parser/text_python.py	Tue Mar 18 19:03:04 2008 +0100
+++ b/MoinMoin/parser/text_python.py	Tue Mar 18 19:22:01 2008 +0100
@@ -69,6 +69,12 @@
         text = StringIO.StringIO(self.raw)
         try:
             tokenize.tokenize(text.readline, self)
+        except IndentationError, ex:
+            msg = ex[0]
+            errmsg = (self.formatter.linebreak() +
+                      self.formatter.strong(1) + "ERROR: %s" % msg + self.formatter.strong(0) +
+                      self.formatter.linebreak())
+            self.request.write(errmsg)
         except tokenize.TokenError, ex:
             msg = ex[0]
             line = ex[1][0]