changeset 64:ea6139631185

text_x_arnica: removed definition of _create_macro and usage from wikiutil.invoke_extension_function
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Wed, 04 Jun 2008 19:51:10 +0200
parents 9301ca6f1e33
children 4a0ef5c802c8
files data/plugin/parser/text_x_arnica.py
diffstat 1 files changed, 7 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/data/plugin/parser/text_x_arnica.py	Wed Jun 04 19:24:51 2008 +0200
+++ b/data/plugin/parser/text_x_arnica.py	Wed Jun 04 19:51:10 2008 +0200
@@ -21,6 +21,7 @@
 from random import randint
 from MoinMoin import caching, wikiutil
 from MoinMoin.action import AttachFile
+from MoinMoin.filter import EXIF
 from MoinMoin.packages import packLine
 from MoinMoin.Page import Page
 from MoinMoin.filter import EXIF
@@ -34,19 +35,17 @@
 
 parser_name = __name__.split('.')[-1]
 
-def macro_arnica(macro, target_page=u'', columns=int(4), file_regex=u'.',
+def macro_arnica(target_page=u'', columns=4, file_regex=u'.',
                  image_for_webnail=False,
                  show_text=True, show_date=True, show_tools=True,
                  sort_by_date=False, sort_by_name=True, sort_by_alias=False,
                  reverse_sort=False,
-                 mode=int(1), only_items=False, template_itemlist=False,
+                 mode=1, only_items=False, template_itemlist=False,
                  album=False, album_name=u'album', front_image=u'',
                  renew=False,
-                 thumbnail_width=int(128), webnail_width=int(640),
-                 text_width=int(128)):
+                 thumbnail_width=128, webnail_width=640,
+                 text_width=128):
     """ 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
     @param columns: number of columns for thumbnails
     @param file_regex: regex to select images
@@ -104,16 +103,14 @@
         self.form = None
         self._ = request.getText
 
-        macro = self._make_macro()
         args = kw.get('format_args', '')
         self.init_settings = False
         # we use a macro definition to initialize the default init parameters
         # 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])
+            settings = wikiutil.invoke_extension_function(request, macro_arnica, args)
             for key, value in settings.items():
-                if key != 'macro':
-                    setattr(self, key, value)
+                setattr(self, key, value)
             # saves the state of valid input
             self.init_settings = True
         except ValueError, err:
@@ -131,19 +128,6 @@
         self.description = [] # array of description
         self.webimg = [] # array of images for forms
 
-    def _make_macro(self):
-        """macro helper used to create the macro object"""
-        from MoinMoin import macro
-        from MoinMoin.parser.text import Parser as text_Parser
-        from MoinMoin.formatter.text_html import Formatter
-        p = text_Parser("##\n", self.request)
-        p.formatter = Formatter(self.request)
-        p.formatter.page = Page(self.request, self.pagename)
-        self.request.formatter = p.formatter
-        p.form = self.request.form
-        m = macro.Macro(p)
-        return m
-
     def show_tools_restricted(self, this_target):
         """ show only tools to users with enough rights
         @param this_target: image