Modify

Opened 17 years ago

Last modified 4 years ago

#1807 new defect

'MediaWikiRenderer' object has no attribute 'render_macro'

Reported by: hornsby.3@… Owned by:
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 (6)

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

Cc: ray.30@… added; anonymous removed

comment:2 Changed 17 years ago by permon

Resolution: fixed
Status: newclosed

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 17 years ago by hornsby.3@…

That worked, thanks!

comment:4 Changed 16 years ago by Michael Breuer

Resolution: fixed
Status: closedreopened
Trac Release: 0.100.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 16 years ago by Michael.Breuer@…

Please let me know if you need more information

comment:6 Changed 4 years ago by Ryan J Ollos

Owner: permon deleted
Status: reopenednew

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The ticket will remain with no owner.

Add Comment


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

 
Note: See TracTickets for help on using tickets.