changeset 55:1eb0c987a260

text_x_arnica: if the parser was called with a not defined parameter, print an error and return.
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Wed, 04 Jun 2008 14:21:02 +0200
parents 5e9898574b01
children d988ec9aa2f5
files data/plugin/parser/text_x_arnica.py
diffstat 1 files changed, 12 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/data/plugin/parser/text_x_arnica.py	Wed Jun 04 13:26:16 2008 +0200
+++ b/data/plugin/parser/text_x_arnica.py	Wed Jun 04 14:21:02 2008 +0200
@@ -120,21 +120,19 @@
 
         macro = self._make_macro()
         args = kw.get('format_args', '')
+        self.init_settings = False
         try:
             settings = wikiutil.invoke_extension_function(macro.request, macro_arnica, args, [macro])
+            keys, values = settings
+            for i in range(len(keys)):
+                setattr(self, keys[i], values[i])
+            self.width = str(self.thumbnail_width + self.text_width)
+            self.outer_table_style = ' border="%d"' % self.border_thick
+            self.init_settings = True
         except ValueError, err:
-            self.request.write(
-                   "arnica: %s" % err.args[0])
-            return
+            msg = u"arnica: %s" % err.args[0]
+            request.write(wikiutil.escape(msg))
 
-        keys, values = settings
-        for i in range(len(keys)):
-            setattr(self, keys[i], values[i])
-
-        # calc
-        self.width = str(self.thumbnail_width + self.text_width)
-
-        self.outer_table_style = ' border="%d"' % self.border_thick
         self.inner_table_style = ' style="border-style:none; margin:10px;"'
         self.td_style = ' align="center" style="padding:0; margin:2px 2px; border-style:none"'
 
@@ -555,6 +553,9 @@
 
         _ = self._
 
+        if not self.init_settings:
+            return
+
         if self.target_page and (not self.request.user.may.read(self.target_page) or not Page(self.request, self.target_page).exists()):
             self.request.write(_("Page %(pagename)s does not exists or you don't have enough rights." % {"pagename": self.target_page}))
             return