= Description = Using the ReStructuredText include directive results in an Internal Server Error for that page. == Steps to reproduce == 1. Create a new wiki page, ex: http://www.moinmo.in/TestPage, or use an existing page. 2. Use rst and make use of the include directive. It doesn't matter if the included page exists, doesn't exist, is or isn't in rst format. See example below. == Example == {{{ #format rst .. include:: anything }}} == Component selection == * general The registered function for the include directive in MoinMoin/parser/text_rst.py does not return a node list. == Details == This Wiki. == Workaround == Add 'include' to the list of disallowed rst directives in MoinMoin/parser/text_rst.py, line 553. ---- Make the include function return a empty list at line 598 remove the error and solve the problem: {{{ lines = [_("**Could not find the referenced page: %s**") % (pagename, )] # Insert the text from the included document and then continue parsing state_machine.insert_input(lines, 'MoinDirectives') - return + return [] include.has_content = include.content = True include.option_spec = {} include.required_arguments = 1 }}} = Discussion = The proposed fix looks incomplete, there are other places that also just use "return". Can you explain why returning an EMPTY list is correct? ---- The problem is that the ''run_directive'' function in ''docutils/parsers/rst/states.py'' is asserting for a list. {{{ try: result = directive_instance.run() except docutils.parsers.rst.DirectiveError, error: [...] assert isinstance(result, list), \ 'Directive "%s" must return a list of nodes but got %s' % (type_name, str(result)) }}} since we already added the text to the document we don't need to return nodes. Just a empty list. ---- Is this needs more clarification? Thanks for the explanation and the patch. I fixed some more places that had the same issue (this is was I meant with "the fix looks incomplete" above). -- ThomasWaldmann <> = Plan = ## This part is for Moin``Moin developers: * Priority: * Assigned to: * Status: fixed by http://hg.moinmo.in/moin/1.9/rev/5955979b0d53 ---- ## If you are a moin core developer, replace the category to Category* in these cases: ## Category MoinMoinNoBug - if this is not a bug. ## Category MoinMoinBugConfirmed - if you can confirm the bug on current code. ## Category MoinMoinBugFixed - after the bug is fixed in current code. CategoryMoinMoinBugFixed