diff MoinMoin/macro/__init__.py @ 2541:5477d7f5ad64

small try/except cleanup in macro code
author Johannes Berg <johannes AT sipsolutions DOT net>
date Mon, 23 Jul 2007 19:36:04 +0200
parents fa4252cb4077
children 56dbfbde79fe
line wrap: on
line diff
--- a/MoinMoin/macro/__init__.py	Mon Jul 23 19:35:49 2007 +0200
+++ b/MoinMoin/macro/__init__.py	Mon Jul 23 19:36:04 2007 +0200
@@ -111,12 +111,12 @@
         """
         self.name = macro_name
         try:
-            try:
-                call = wikiutil.importPlugin(self.cfg, 'macro', macro_name,
-                                             function='macro_%s' % macro_name)
-                execute = lambda _self, _args: _self._wrap(call, _args, [self])
-            except wikiutil.PluginAttributeError:
-                execute = wikiutil.importPlugin(self.cfg, 'macro', macro_name)
+            call = wikiutil.importPlugin(self.cfg, 'macro', macro_name,
+                                         function='macro_%s' % macro_name)
+            execute = lambda _self, _args: _self._wrap(call, _args, [self])
+        except wikiutil.PluginAttributeError:
+            # fall back to old execute() method, no longer recommended
+            execute = wikiutil.importPlugin(self.cfg, 'macro', macro_name)
         except wikiutil.PluginMissingError:
             try:
                 call = getattr(self, 'macro_%s' % macro_name)