diff MoinMoin/macro/__init__.py @ 2513:6de0e14591f7

macro.format_error to format what a macro shows in case of ValueError/TypeError happening, refactor MonthCalendar to use new arg parsing
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sun, 22 Jul 2007 21:11:51 +0200
parents ea255685d6b0
children 41bc022c2160
line wrap: on
line diff
--- a/MoinMoin/macro/__init__.py	Sun Jul 22 18:53:36 2007 +0200
+++ b/MoinMoin/macro/__init__.py	Sun Jul 22 21:11:51 2007 +0200
@@ -133,10 +133,11 @@
 
         try:
             return fn(self, *positional, **kwargs)
-        except TypeError, e:
-            return u'[[%s]]' % str(e)
-        except ValueError, e:
-            return u'[[%s: %s]]' % (macro_name, str(e))
+        except (ValueError, TypeError), e:
+            return self.format_error(e)
+
+    def format_error(self, err):
+        return u'[[%s: %s]]' % (self.name, str(err))
 
     def execute(self, macro_name, args):
         """ Get and execute a macro