Modify

Opened 7 years ago

Last modified 6 years ago

#1807 reopened defect

'MediaWikiRenderer' object has no attribute 'render_macro'

Reported by: hornsby.3@… Owned by: permon
Priority: normal Component: MediaWikiPluginMacro
Severity: blocker Keywords:
Cc: ray.30@… Trac Release: 0.9

Description

After adding the demo code to a page, python can't find something it needs

Python Traceback

Traceback (most recent call last):
  File "/var/lib/python-support/python2.4/trac/web/main.py", line 387, in dispatch_request
    dispatcher.dispatch(req)
  File "/var/lib/python-support/python2.4/trac/web/main.py", line 237, in dispatch
    resp = chosen_handler.process_request(req)
  File "/var/lib/python-support/python2.4/trac/wiki/web_ui.py", line 135, in process_request
    self._render_view(req, db, page)
  File "/var/lib/python-support/python2.4/trac/wiki/web_ui.py", line 443, in _render_view
    req.hdf['wiki'] = {
  File "/var/lib/python-support/python2.4/trac/wiki/formatter.py", line 999, in wiki_to_html
    Formatter(env, req, absurls, db).format(wikitext, out, escape_newlines)
  File "/var/lib/python-support/python2.4/trac/wiki/formatter.py", line 793, in format
    self.handle_code_block(line)
  File "/var/lib/python-support/python2.4/trac/wiki/formatter.py", line 732, in handle_code_block
    self.out.write(to_unicode(self.code_processor.process(
  File "/var/lib/python-support/python2.4/trac/wiki/formatter.py", line 112, in process
    text = self.processor(req, text)
  File "/var/lib/python-support/python2.4/trac/wiki/formatter.py", line 100, in _macro_processor
    return self.macro_provider.render_macro(req, self.name, text)
AttributeError: 'MediaWikiRenderer' object has no attribute 'render_macro'

I think the plugin is installed correctly:
# easy_install http://trac-hacks.org/svn/mediawikipluginmacro

And if I comment out the mediawiki.* = enabled part of the trac.ini, trac says that it doesn't know what to do with the mediawiki directive when loading the page, which makes sense.

Is there a specific dependency that this plugin relies on?

Attachments (0)

Change History (5)

comment:1 Changed 7 years ago by hornsby.3@…

  • Cc ray.30@… added

comment:2 Changed 7 years ago by permon

  • Resolution set to fixed
  • Status changed from new to closed

render_macro is old way of plugin interfacing and should be deprecated in new ones. But I've just added it (in r2483)as an alias for expand_macro. Macro has worked with current trunk. Now should be working with older versions. There are no dependencies.

comment:3 Changed 7 years ago by hornsby.3@…

That worked, thanks!

comment:4 Changed 6 years ago by Michael Breuer

  • Resolution fixed deleted
  • Status changed from closed to reopened
  • Trac Release changed from 0.10 to 0.9

I just tried to use the example wiki page

(http://trac-hacks.org/wiki/MediaWikiPluginMacro)

and get

Traceback (most recent call last):

File "/usr/lib/python2.4/site-packages/trac/web/modpython_frontend.py", line 206, in handler

dispatch_request(mpr.path_info, mpr, env)

File "/usr/lib/python2.4/site-packages/trac/web/main.py", line 139, in dispatch_request

dispatcher.dispatch(req)

File "/usr/lib/python2.4/site-packages/trac/web/main.py", line 107, in dispatch

resp = chosen_handler.process_request(req)

File "/usr/lib/python2.4/site-packages/trac/wiki/web_ui.py", line 116, in process_request

self._render_view(req, db, page)

File "/usr/lib/python2.4/site-packages/trac/wiki/web_ui.py", line 364, in _render_view

req.hdfwiki.page_html? = wiki_to_html(page.text, self.env, req)

File "/usr/lib/python2.4/site-packages/trac/wiki/formatter.py", line 751, in wiki_to_html

Formatter(env, req, absurls, db).format(wikitext, out, escape_newlines)

File "/usr/lib/python2.4/site-packages/trac/wiki/formatter.py", line 577, in format

self.handle_code_block(line)

File "/usr/lib/python2.4/site-packages/trac/wiki/formatter.py", line 547, in handle_code_block

self.out.write(self.code_processor.process(self.req, self.code_text))

File "/usr/lib/python2.4/site-packages/trac/wiki/formatter.py", line 109, in process

text = self.processor(req, text)

File "/usr/lib/python2.4/site-packages/trac/wiki/formatter.py", line 99, in _macro_processor

return macro_provider.render_macro(req, self.name, text)

File "/usr/lib/python2.4/site-packages/trac/core.py", line 165, in getattr

raise AttributeError, "'%s' object has no attribute '%s'" % (cls, name)

AttributeError: 'mediawiki.parser.MediaWikiRenderer' object has no attribute 'render_macro'

I examined my mediawiki.py and its the same as in r2483.

Are there other thinks to be careful ?

comment:5 Changed 6 years ago by Michael.Breuer@…

Please let me know if you need more information

Add Comment

Modify Ticket

Action
as reopened .
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.