changeset 52:5bbe341cd721

macros: fixes, remove crap, cleanup
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Tue, 01 Mar 2011 21:41:39 +0100
parents 8102f92d21b8
children 62166a1c4f2a
files MoinMoin/macro/Anchor.py MoinMoin/macro/Date.py MoinMoin/macro/DateTime.py MoinMoin/macro/EditedSystemPages.py MoinMoin/macro/GetText.py MoinMoin/macro/GetVal.py MoinMoin/macro/GoTo.py MoinMoin/macro/HighlighterList.py MoinMoin/macro/InterWiki.py MoinMoin/macro/MailTo.py MoinMoin/macro/PageCount.py MoinMoin/macro/PageSize.py MoinMoin/macro/PagenameList.py MoinMoin/macro/RandomItem.py MoinMoin/macro/TemplateList.py MoinMoin/macro/Verbatim.py MoinMoin/macro/WikiConfig.py MoinMoin/macro/WikiConfigHelp.py MoinMoin/macro/_base.py
diffstat 19 files changed, 137 insertions(+), 188 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/macro/Anchor.py	Tue Mar 01 17:34:56 2011 +0100
+++ b/MoinMoin/macro/Anchor.py	Tue Mar 01 21:41:39 2011 +0100
@@ -1,8 +1,8 @@
-# Copyright: 2008 MoinMoin:ThomasWaldmann
+# Copyright: 2008,2011 MoinMoin:ThomasWaldmann
 # License: GNU GPL v2 (or any later version), see LICENSE.txt for details.
 
 """
-    MoinMoin - Anchor Macro to put an anchor at the place where it is used.
+MoinMoin - Anchor Macro to put an anchor at the place where it is used.
 """
 
 
@@ -10,9 +10,10 @@
 from MoinMoin.macro._base import MacroInlineBase
 
 class Macro(MacroInlineBase):
-    def macro(self, anchor=unicode):
-        if not anchor:
+    def macro(self, content, arguments, page_url, alternative):
+        if not arguments:
             raise ValueError("Anchor: you need to specify an anchor name.")
 
+        anchor = arguments[0]
         return moin_page.span(attrib={moin_page.id: anchor})
 
--- a/MoinMoin/macro/Date.py	Tue Mar 01 17:34:56 2011 +0100
+++ b/MoinMoin/macro/Date.py	Tue Mar 01 21:41:39 2011 +0100
@@ -1,13 +1,14 @@
-# Copyright: 2008-2010 MoinMoin:ThomasWaldmann
+# Copyright: 2008-2011 MoinMoin:ThomasWaldmann
 # License: GNU GPL v2 (or any later version), see LICENSE.txt for details.
 
 """
-    MoinMoin Date macro - outputs the date for some specific point in time,
-    adapted to the TZ settings of the user viewing the content.
+MoinMoin Date macro - outputs the date for some specific point in time,
+adapted to the TZ settings of the user viewing the content.
 """
 
 
 import time
+from datetime import datetime
 
 from flask import flaskg
 from flaskext.babel import format_date
@@ -22,9 +23,7 @@
                      float/int UNIX timestamp
         :returns: UNIX timestamp (UTC)
         """
-        if args is None:
-            tm = time.time() # always UTC
-        elif (len(args) >= 19 and args[4] == '-' and args[7] == '-' and
+        if (len(args) >= 19 and args[4] == '-' and args[7] == '-' and
               args[10] == 'T' and args[13] == ':' and args[16] == ':'):
             # we ignore any time zone offsets here, assume UTC,
             # and accept (and ignore) any trailing stuff
@@ -58,7 +57,12 @@
         return tm
 
 class Macro(MacroDateTimeBase):
-    def macro(self, stamp=None):
-        tm = self.parse_time(stamp)
-        return format_date(tm)
+    def macro(self, content, arguments, page_url, alternative):
+        if arguments is None:
+            tm = time.time() # always UTC
+        else:
+            # XXX looks like args are split at ':' -> <Arguments([u'2010-12-31T23', u'59', u'00'], {})>
+            stamp = arguments[0]
+            tm = self.parse_time(stamp)
+        return format_date(datetime.utcfromtimestamp(tm))
 
--- a/MoinMoin/macro/DateTime.py	Tue Mar 01 17:34:56 2011 +0100
+++ b/MoinMoin/macro/DateTime.py	Tue Mar 01 21:41:39 2011 +0100
@@ -1,11 +1,13 @@
-# Copyright: 2008-2010 MoinMoin:ThomasWaldmann
+# Copyright: 2008-2011 MoinMoin:ThomasWaldmann
 # License: GNU GPL v2 (or any later version), see LICENSE.txt for details.
 
 """
-    MoinMoin DateTime macro - outputs the date and time for some specific point in time,
-    adapted to the TZ settings of the user viewing the content.
+MoinMoin DateTime macro - outputs the date and time for some specific point in time,
+adapted to the TZ settings of the user viewing the content.
 """
 
+import time
+from datetime import datetime
 
 from flask import flaskg
 from flaskext.babel import format_datetime
@@ -13,7 +15,11 @@
 from MoinMoin.macro.Date import MacroDateTimeBase
 
 class Macro(MacroDateTimeBase):
-    def macro(self, stamp=None):
-        tm = self.parse_time(stamp)
-        return format_datetime(tm)
+    def macro(self, content, arguments, page_url, alternative):
+        if arguments is None:
+            tm = time.time() # always UTC
+        else:
+            stamp = arguments[0]
+            tm = self.parse_time(stamp)
+        return format_datetime(datetime.utcfromtimestamp(tm))
 
--- a/MoinMoin/macro/EditedSystemPages.py	Tue Mar 01 17:34:56 2011 +0100
+++ b/MoinMoin/macro/EditedSystemPages.py	Tue Mar 01 21:41:39 2011 +0100
@@ -1,37 +1,35 @@
 # Copyright: 2004 Nir Soffer <nirs@freeshell.org>
-# Copyright: 2008 MoinMoin:ThomasWaldmann
+# Copyright: 2008,2011 MoinMoin:ThomasWaldmann
 # License: GNU GPL v2 (or any later version), see LICENSE.txt for details.
 
 """
-    EditedSystemPages - list system pages that has been edited in this wiki.
+EditedSystemPages - list system pages that has been edited in this wiki.
 """
 
 
 from flask import flaskg
 
-from MoinMoin.Page import Page
 from MoinMoin.macro._base import MacroPageLinkListBase
+from MoinMoin.items import IS_SYSITEM
+from MoinMoin.storage.error import NoSuchRevisionError
 
 class Macro(MacroPageLinkListBase):
-    def macro(self):
-        from MoinMoin.Page import Page
-        from MoinMoin.items import IS_SYSITEM
-
-        # Get item list for current user (use this as admin), filter
-        # items that are sysitems
-        def filterfn(name):
-            item = flaskg.storage.get_item(name)
+    def macro(self, content, arguments, page_url, alternative):
+        edited_sys_items = []
+        for item in flaskg.storage.iteritems():
             try:
-                return item.get_revision(-1)[IS_SYSITEM]
-            except KeyError:
-                return False
+                rev = item.get_revision(-1)
+            except NoSuchRevisionError:
+                continue
+            is_sysitem = rev.get(IS_SYSITEM, False)
+            if is_sysitem:
+                version = rev.get(SYSITEM_VERSION)
+                if version is None:
+                    # if we don't have the version, it was edited:
+                    edited_sys_items.append(item.name)
 
-        # Get page filtered page list. We don't need to filter by
-        # exists, because our filter check this already.
-        pagenames = list(self.request.rootpage.getPageList(filter=filterfn, exists=0))
+        # Format as numbered list, sorted by item name
+        edited_sys_items.sort()
 
-        # Format as numbered list, sorted by page name
-        pagenames.sort()
+        return self.create_pagelink_list(edited_sys_items, ordered=True)
 
-        return self.create_pagelink_list(pagenames, ordered=True)
-
--- a/MoinMoin/macro/GetText.py	Tue Mar 01 17:34:56 2011 +0100
+++ b/MoinMoin/macro/GetText.py	Tue Mar 01 21:41:39 2011 +0100
@@ -1,14 +1,14 @@
 # Copyright: 2001 Juergen Hermann <jh@web.de>
-# Copyright: 2008 MoinMoin:ThomasWaldmann
+# Copyright: 2008,2011 MoinMoin:ThomasWaldmann
 # License: GNU GPL v2 (or any later version), see LICENSE.txt for details.
 
 """
-    MoinMoin - Load I18N Text
+MoinMoin - Load I18N Text
 
-    This macro has the main purpose of supporting Help* page authors
-    to insert the texts that a user actually sees on his screen into
-    the description of the related features (which otherwise could
-    get very confusing).
+This macro has the main purpose of supporting Help* page authors
+to insert the texts that a user actually sees on his screen into
+the description of the related features (which otherwise could
+get very confusing).
 """
 
 
@@ -17,8 +17,8 @@
 
 class Macro(MacroInlineBase):
     """ Return a translation of args, or args as is """
-    def macro(self, content, args, page_url, alt):
-        translation = ' '.join(args.positional)
+    def macro(self, content, arguments, page_url, alternative):
+        translation = ' '.join(arguments.positional)
         translation = _(translation)
         return translation
 
--- a/MoinMoin/macro/GetVal.py	Tue Mar 01 17:34:56 2011 +0100
+++ b/MoinMoin/macro/GetVal.py	Tue Mar 01 21:41:39 2011 +0100
@@ -1,8 +1,8 @@
-# Copyright: 2008 MoinMoin:ThomasWaldmann
+# Copyright: 2008,2011 MoinMoin:ThomasWaldmann
 # License: GNU GPL v2 (or any later version), see LICENSE.txt for details.
 
 """
-    MoinMoin GetVal macro - gets a value for a specified key from a dict.
+MoinMoin GetVal macro - gets a value for a specified key from a dict.
 """
 
 
@@ -11,12 +11,15 @@
 from MoinMoin.macro._base import MacroInlineBase
 
 class Macro(MacroInlineBase):
-    def macro(self, page=unicode, key=unicode):
-        if page is None or key is None:
-            raise ValueError("GetVal: you have to give pagename, key.")
-        if not flaskg.user.may.read(page):
+    def macro(self, content, arguments, page_url, alternative):
+        try:
+            item_name = arguments[0]
+            key = arguments[1]
+        except IndexError:
+            raise ValueError("GetVal: you have to give itemname, key.")
+        if not flaskg.user.may.read(item_name):
             raise ValueError("You don't have enough rights on this page")
-        d = flaskg.dicts.dict(page)
+        d = flaskg.dicts[item_name]
         result = d.get(key, '')
         return result
 
--- a/MoinMoin/macro/GoTo.py	Tue Mar 01 17:34:56 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-# Copyright: 2008 MoinMoin:BastianBlank
-# License: GNU GPL v2 (or any later version), see LICENSE.txt for details.
-
-"""
-MoinMoin - GoTo macro
-
-Provides a goto box.
-"""
-
-
-from emeraldtree import ElementTree as ET
-
-from MoinMoin.i18n import _, L_, N_
-from MoinMoin.macro._base import MacroBlockBase
-from MoinMoin.util.tree import html
-
-class Macro(MacroBlockBase):
-    def macro(self):
-        return ET.XML("""
-<form xmlns="%s" method="get" action="%s/%s">
-    <input type="hidden" name="do" value="goto" />
-    <p>
-        <input type="text" name="target" size="30" />
-        <input type="submit" value="%s" />
-    </p>
-</form>
-""" % (html,
-        self.request.getScriptname(),
-        self.page_name,
-        _("Go To Item"))) #HHH ?
--- a/MoinMoin/macro/HighlighterList.py	Tue Mar 01 17:34:56 2011 +0100
+++ b/MoinMoin/macro/HighlighterList.py	Tue Mar 01 21:41:39 2011 +0100
@@ -1,13 +1,13 @@
 # Copyright: 2009 MoinMoin:EugeneSyromyatnikov
-# Copyright: 2010 MoinMoin:ThomasWaldmann
+# Copyright: 2010,2011 MoinMoin:ThomasWaldmann
 # License: GNU GPL v2 (or any later version), see LICENSE.txt for details.
 
 """
-    MoinMoin - HighlighterList Macro
+MoinMoin - HighlighterList Macro
 
-    A simple macro for displaying a table with list of available Pygments lexers.
+A simple macro for displaying a table with list of available Pygments lexers.
 
-    Usage: <<HighlighterList>>
+Usage: <<HighlighterList>>
 """
 
 
@@ -21,7 +21,6 @@
 
 class Macro(TableMixin, MacroBlockBase):
     def macro(self, content, arguments, page_url, alternative):
-        request = self.request
         column_titles = [_('Lexer description'),
                          _('Lexer names'),
                          _('File patterns'),
--- a/MoinMoin/macro/InterWiki.py	Tue Mar 01 17:34:56 2011 +0100
+++ b/MoinMoin/macro/InterWiki.py	Tue Mar 01 21:41:39 2011 +0100
@@ -1,8 +1,8 @@
-# Copyright: 2007-2008 MoinMoin:ThomasWaldmann
+# Copyright: 2007-2008,2011 MoinMoin:ThomasWaldmann
 # License: GNU GPL v2 (or any later version), see LICENSE.txt for details.
 
 """
-    Outputs the interwiki map.
+Outputs the interwiki map.
 """
 
 
@@ -13,7 +13,7 @@
 from MoinMoin.macro._base import MacroBlockBase
 
 class Macro(MacroBlockBase):
-    def macro(self):
+    def macro(self, content, arguments, page_url, alternative):
         iwlist = app.cfg.interwiki_map.items()
         iwlist.sort()
 
--- a/MoinMoin/macro/MailTo.py	Tue Mar 01 17:34:56 2011 +0100
+++ b/MoinMoin/macro/MailTo.py	Tue Mar 01 21:41:39 2011 +0100
@@ -1,9 +1,9 @@
-# Copyright: 2008 MoinMoin:ThomasWaldmann
+# Copyright: 2008,2011 MoinMoin:ThomasWaldmann
 # License: GNU GPL v2 (or any later version), see LICENSE.txt for details.
 
 """
-    MoinMoin - MailTo Macro displays an E-Mail address (either a valid mailto:
-    link for logged in users or an obfuscated display as given as the macro argument.
+MoinMoin - MailTo Macro displays an E-Mail address (either a valid mailto:
+link for logged in users or an obfuscated display as given as the macro argument.
 """
 
 
@@ -13,10 +13,18 @@
 from MoinMoin.macro._base import MacroInlineBase
 
 class Macro(MacroInlineBase):
-    def macro(self, email=unicode, text=u''):
-        if not email:
+    def macro(self, content, arguments, page_url, alternative):
+        # TODO new arg parsing is not compatible, splits at blanks
+        try:
+            email = arguments[0]
+        except IndexError:
             raise ValueError("You need to give an (obfuscated) email address")
 
+        try:
+            text = arguments[1]
+        except IndexError:
+            text = u''
+
         from MoinMoin.mail.sendmail import decodeSpamSafeEmail
 
         if flaskg.user.valid:
@@ -31,7 +39,3 @@
 
         return result
 
-
-
-
-
--- a/MoinMoin/macro/PageCount.py	Tue Mar 01 17:34:56 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-# Copyright: 2007 MoinMoin:ThomasWaldmann
-# Copyright: 2008 MoinMoin:BastianBlank
-# License: GNU GPL v2 (or any later version), see LICENSE.txt for details.
-
-"""
-    Outputs the page count of the wiki.
-"""
-
-
-from MoinMoin.macro._base import MacroInlineBase
-
-class Macro(MacroInlineBase):
-    def macro(self, exists=None):
-        """ Return number of pages readable by current user
-
-        Return either an exact count (slow!) or fast count including deleted pages.
-
-        TODO: make macro syntax more sane
-        """
-        request = self.request
-
-        # Check input
-        only_existing = False
-        if exists == u'exists':
-            only_existing = True
-        elif exists:
-            raise ValueError("Wrong argument: %r" % exists)
-
-        count = request.rootpage.getPageCount(exists=only_existing)
-        return "%d" % count
-
--- a/MoinMoin/macro/PageSize.py	Tue Mar 01 17:34:56 2011 +0100
+++ b/MoinMoin/macro/PageSize.py	Tue Mar 01 21:41:39 2011 +0100
@@ -1,23 +1,26 @@
 # Copyright: 2002 Juergen Hermann <jh@web.de>
-# Copyright: 2008 MoinMoin:ThomasWaldmann
+# Copyright: 2008,2011 MoinMoin:ThomasWaldmann
 # License: GNU GPL v2 (or any later version), see LICENSE.txt for details.
 
 """
-    MoinMoin - PageSize Macro displays an ordered list with page sizes and names
+MoinMoin - PageSize Macro displays an ordered list with page sizes and names
 """
 
-
-from MoinMoin.Page import Page
+from flask import flaskg
+from MoinMoin.storage.error import NoSuchRevisionError
 from MoinMoin.macro._base import MacroNumberPageLinkListBase
 
 class Macro(MacroNumberPageLinkListBase):
-    def macro(self):
-        # get list of pages and their objects
-        pages = self.request.rootpage.getPageList()
-
-        # get sizes and sort them
-        sizes_pagenames = [(Page(self.request, name).size(), name)
-                for name, page in pages.items()]
+    def macro(self, content, arguments, page_url, alternative):
+        sizes_pagenames = []
+        for item in flaskg.storage.iteritems():
+            try:
+                rev = item.get_revision(-1)
+            except NoSuchRevisionError:
+                # XXX we currently also get user items, they have no revisions -
+                # but in the end, they should not be readable by the user anyways
+                continue
+            sizes_pagenames.append((rev.size, item.name))
         sizes_pagenames.sort()
         sizes_pagenames.reverse()
 
--- a/MoinMoin/macro/PagenameList.py	Tue Mar 01 17:34:56 2011 +0100
+++ b/MoinMoin/macro/PagenameList.py	Tue Mar 01 21:41:39 2011 +0100
@@ -1,19 +1,27 @@
-# Copyright: 2008 MoinMoin:ThomasWaldmann
+# Copyright: 2008,2011 MoinMoin:ThomasWaldmann
 # License: GNU GPL v2 (or any later version), see LICENSE.txt for details.
 
 """
-    PagenameList - list pages with names matching a string or regex
+PagenameList - list pages with names matching a string or regex
 
-    Note: PageList is a similar thing using the search engine.
+Note: PageList is a similar thing using the search engine.
 """
 
 
 import re
 
+from flask import flaskg
+
 from MoinMoin.macro._base import MacroPageLinkListBase
 
 class Macro(MacroPageLinkListBase):
-    def macro(self, needle=u'', regex=False):
+    def macro(self, content, arguments, page_url, alternative):
+        # needle=u'', regex=False
+        needle = arguments[0]
+        try:
+            regex = arguments[1] == 'True'
+        except IndexError:
+            regex = False
         re_flags = re.IGNORECASE
         if regex:
             try:
@@ -23,9 +31,12 @@
         else:
             needle_re = re.compile(re.escape(needle), re_flags)
 
-        # Get page list readable by current user, filtered by needle
-        pagenames = self.request.rootpage.getPageList(filter=needle_re.search)
-        pagenames.sort()
+        item_names = []
+        for item in flaskg.storage.iteritems():
+            if needle_re.search(item.name):
+                item_names.append(item.name)
 
-        return self.create_pagelink_list(pagenames, ordered=False)
+        item_names.sort()
 
+        return self.create_pagelink_list(item_names, ordered=False)
+
--- a/MoinMoin/macro/RandomItem.py	Tue Mar 01 17:34:56 2011 +0100
+++ b/MoinMoin/macro/RandomItem.py	Tue Mar 01 21:41:39 2011 +0100
@@ -1,17 +1,19 @@
 # Copyright: 2000 Juergen Hermann <jh@web.de>
-# Copyright: 2008-2010 MoinMoin:ThomasWaldmann
+# Copyright: 2008-2011 MoinMoin:ThomasWaldmann
 # License: GNU GPL v2 (or any later version), see LICENSE.txt for details.
 
 """
-    MoinMoin - RandomItem Macro displays one or multiple random item links.
+MoinMoin - RandomItem Macro displays one or multiple random item links.
 
-    TODO: add mimetype param and only show items matching this mimetype
+TODO: add mimetype param and only show items matching this mimetype
 """
 
 
 import random
 random.seed()
 
+from flask import flaskg
+
 from MoinMoin.util.iri import Iri
 from MoinMoin.util.tree import moin_page, xlink
 from MoinMoin.items import Item, AccessDeniedError
@@ -20,15 +22,12 @@
 
 class Macro(MacroInlineBase):
     def macro(self, content, arguments, page_url, alternative):
-        request = self.request
-
         if arguments:
             item_count = int(arguments[0])
         else:
             item_count = 1
 
-        rootitem = Item(request, u'')
-        all_item_names = [i.name for i in rootitem.list_items()]
+        all_item_names = [i.name for i in flaskg.storage.iteritems()]
 
         # Now select random item from the full list, and if it exists and
         # we can read it, save.
--- a/MoinMoin/macro/TemplateList.py	Tue Mar 01 17:34:56 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,15 +0,0 @@
-# Copyright: 2008 MoinMoin:ThomasWaldmann
-# License: GNU GPL v2 (or any later version), see LICENSE.txt for details.
-
-"""
-    TemplateList - compatibility wrapper around PagenameList
-"""
-
-
-from MoinMoin.macro.PagenameList import Macro as PNLMacro
-
-class Macro(PNLMacro):
-    def macro(self, needle=u''):
-        return super(Macro, self).macro(needle, regex=True)
-
-
--- a/MoinMoin/macro/Verbatim.py	Tue Mar 01 17:34:56 2011 +0100
+++ b/MoinMoin/macro/Verbatim.py	Tue Mar 01 21:41:39 2011 +0100
@@ -2,7 +2,7 @@
 # License: GNU GPL v2 (or any later version), see LICENSE.txt for details.
 
 """
-    Outputs the text verbatimly.
+Outputs the text verbatimly.
 """
 
 
--- a/MoinMoin/macro/WikiConfig.py	Tue Mar 01 17:34:56 2011 +0100
+++ b/MoinMoin/macro/WikiConfig.py	Tue Mar 01 21:41:39 2011 +0100
@@ -1,9 +1,9 @@
 # Copyright: 2008 MoinMoin:JohannesBerg
-# Copyright: 2008 MoinMoin:ThomasWaldmann
+# Copyright: 2008,2011 MoinMoin:ThomasWaldmann
 # License: GNU GPL v2 (or any later version), see LICENSE.txt for details.
 
 """
-    MoinMoin - Show Wiki Configuration
+MoinMoin - Show Wiki Configuration
 """
 
 
@@ -17,7 +17,7 @@
 from MoinMoin.util.tree import moin_page
 
 class Macro(MacroBlockBase):
-    def macro(self):
+    def macro(self, content, arguments, page_url, alternative):
         if not flaskg.user or not flaskg.user.isSuperUser():
             return ''
 
--- a/MoinMoin/macro/WikiConfigHelp.py	Tue Mar 01 17:34:56 2011 +0100
+++ b/MoinMoin/macro/WikiConfigHelp.py	Tue Mar 01 21:41:39 2011 +0100
@@ -1,9 +1,9 @@
 # Copyright: 2008 MoinMoin:JohannesBerg
-# Copyright: 2008 MoinMoin:ThomasWaldmann
+# Copyright: 2008,2011 MoinMoin:ThomasWaldmann
 # License: GNU GPL v2 (or any later version), see LICENSE.txt for details.
 
 """
-    MoinMoin - Show Wiki Configuration Help
+MoinMoin - Show Wiki Configuration Help
 """
 
 
@@ -13,9 +13,7 @@
 from MoinMoin.util.tree import moin_page
 
 class Macro(MacroBlockBase):
-    def macro(self):
-        request = self.request
-
+    def macro(self, content, arguments, page_url, alternative):
         groups = []
         for groupname in defaultconfig.options:
             groups.append((groupname, True, defaultconfig.options))
--- a/MoinMoin/macro/_base.py	Tue Mar 01 17:34:56 2011 +0100
+++ b/MoinMoin/macro/_base.py	Tue Mar 01 21:41:39 2011 +0100
@@ -17,8 +17,8 @@
     # The output of a immutable macro only depends on the arguments and the content
     immutable = False
 
-    def __init__(self, request):
-        self.request = request
+    def __init__(self):
+        pass
 
     def __call__(self, content, arguments, page_url, alternative, context_block):
         raise NotImplementedError
@@ -35,7 +35,7 @@
             return self.macro(content, arguments, page_url, alternative)
         return self.alt
 
-    def macro(self, content, page_url, args, alt):
+    def macro(self, content, arguments, page_url, alternative):
         raise NotImplementedError
 
 class MacroInlineBase(MacroBase):
@@ -77,7 +77,7 @@
 class MacroNumberPageLinkListBase(MacroBlockBase):
     def create_number_pagelink_list(self, num_pagenames, ordered=False):
         """ creates an ET with a list of pagelinks from a list of pagenames """
-        page_list = moin_page.list(attrib={moin_page.item_label_generate: ordered and 'ordered' or 'unordered'})
+        num_page_list = moin_page.list(attrib={moin_page.item_label_generate: ordered and 'ordered' or 'unordered'})
         for num, pagename in num_pagenames:
             num_code = moin_page.code(children=["%6d " % num])
             # This link can never reach pagelinks
@@ -99,4 +99,3 @@
             def_list.append(item)
         return def_list
 
-