Description

While adding a macro to the footer in modern.py theme I recognized that it won't right execute if the attachfile action is called on a page. -- ReimarBauer 2005-10-22 16:37:45

The error is:

args = ("Formatter instance has no attribute 'page'",)

This behaviour was discussed with NirSoffer on the MoinMoinQuestions

Example

#format python
    def footer(self, d, **keywords):
        """ Assemble wiki footer
        
        @param d: parameter dictionary
        @keyword ...:...
        @rtype: unicode
        @return: page footer html
        """
 
        Parser = wikiutil.importPlugin(self.request.cfg, 'parser', 'wiki', 'Parser')  
        Hits = Parser('[[Hits]]', self.request).format(self.request.formatter)
       
        page = d['page']
       
        html = [
            # End of page
            self.pageinfo(page),
            self.endPage(),
            
            # Pre footer custom html (not recommended!)
            self.emit_custom_html(self.cfg.page_footer1),
            
            # Footer
            u'<div id="footer">',
            self.editbar(d),
            self.credits(d),
            self.showversion(d, **keywords),
            u'</div>',
            
            # Post footer custom html
            self.emit_custom_html(self.cfg.page_footer2),
            self.emit_custom_html(str(Hits)),
            ]
        return u'\n'.join(html)

Details

MoinMoin Version

1.5.0 Patchlevel 129

OS and Version

linux

Python Version

2.3.5

Server Setup

cgi-bin

Server Details

apache2

Workaround

Nirs suggestion was to add this before the wikiutil.importPlugin call.

self.request.formatter.page = d["page"]

Discussion

This is not a MoinMoin bug, it is just a problematic extension:

Plan


CategoryMoinMoinNoBug

MoinMoin: MoinMoinBugs/AddingMacroToThemeFooterCrashOnAttachFileAction (last edited 2007-10-29 19:17:24 by localhost)