Description
The request.formatter.parser() function will sometimes write its result to the request, as documented in the comments in FormatterBase code, but sometimes it will not write to the request and instead return the result as a return value (even though the code in the FormatterBase seems to always return "").
In fact it either does:
return and write result to request, or
return '<<<>>>' and do not write anything to request. the '<<<>>>' is a marker used by text_python formatter to tell "insert code here" and the code will be dynamically called (and will write the result to request)
Steps to reproduce
Redirect output in the request with request.redirect() to a StringIO buffer
Call request.formatter.parser for the text/python parser
Check the buffer's getvalue()
- It's empty
Component selection
Details
The funny thing is, when I copy the code from the FormatterBase into my parser directly, instead of calling it, it works fine -- so my guess is that the method is somehow overriden.
MoinMoin Version |
1.6, 1.7 |
OS and Version |
|
Python Version |
|
Server Setup |
|
Server Details |
|
Language you are using the wiki in (set in the browser/UserPreferences) |
|
Workaround
Get both the return value and the buffer, and concatenate them for the actual result.
Discussion
After refactoring the text_python, assemble_code etc. voodoo, we could refactor the parsers to return the result and not use request.write.
Plan
- Priority:
- Assigned to:
- Status: