changeset 61:6ab80d79e924

text_x_arnica.macro_arnica: much more simplified using locals()
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Wed, 04 Jun 2008 15:46:16 +0200
parents d88a6a086d04
children 23b9e0024ede
files data/plugin/parser/text_x_arnica.py
diffstat 1 files changed, 5 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/data/plugin/parser/text_x_arnica.py	Wed Jun 04 15:16:31 2008 +0200
+++ b/data/plugin/parser/text_x_arnica.py	Wed Jun 04 15:46:16 2008 +0200
@@ -44,7 +44,7 @@
                  renew=False,
                  thumbnail_width=int(128), webnail_width=int(640),
                  text_width=int(128)):
-    """ macro to initialize all default parameters for arnica. The definition is checked for wrong input.
+    """ dummy macro to initialize all default parameters for arnica. The definition is checked for wrong input.
     @param macro: is used from wikiutil.invoke_extension_function
 
     @param target_page: page to read attachments from
@@ -76,21 +76,7 @@
     @param webnail_width: default width of webnail is 640
     @param text_width: default width of text is 140
     """
-    from inspect import getargspec
-    args = getargspec(macro_arnica)[0]
-    # ToDo find the proper method do get the real values without entering the list
-    values = (target_page, columns, file_regex,
-              image_for_webnail,
-              show_text, show_date, show_tools,
-              sort_by_date, sort_by_name, sort_by_alias,
-              reverse_sort,
-              mode, only_items, template_itemlist,
-              album, album_name, front_image,
-              renew,
-              thumbnail_width, webnail_width,
-              text_width)
-
-    return (args[1:], values)
+    return locals()
 
 # ToDo may be move to wikiutil
 def get_exif_info(file_name):
@@ -125,9 +111,9 @@
         # if a user enters a wrong parameter the failure is shown by the exception
         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])
+            for key, value in settings.items():
+                if key != 'macro':
+                    setattr(self, key, value)
             # saves the state of valid input
             self.init_settings = True
         except ValueError, err: