0

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?

blueberryfields
  • 45,910
  • 28
  • 89
  • 168

1 Answers1

0

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

parsed_formatted_string = self.request.redirectedOutput(wp.format, self.formatter)
blueberryfields
  • 45,910
  • 28
  • 89
  • 168