blueberryfields
blueberryfields

Reputation: 50468

How do I capture the output from a MoinMoin parser?

Say I'm writing a parser, and want to include the output of another parser in the results I'm returning. If I do something like this:

WikiParser = wikiutil.importPlugin(self.request.cfg, 'parser', 'text_moin_wiki', 'Parser')
wp = WikiParser("some text",self.request)
wp.format(self.formatter)

then WikiParser will throw the results of its work straight into my self.request object.

I'd like to intercept that, though - I'd rather grab the results of the WikiParser work, and manipulate them a bit more.

Is there a way for me to do this? How do I do it?

Upvotes: 0

Views: 54

Answers (1)

blueberryfields
blueberryfields

Reputation: 50468

The Request object has a redirectedOutput function, just for this purpose:

parsed_formatted_string = self.request.redirectedOutput(wp.format, self.formatter)

Upvotes: 0

Related Questions