foobar theme crashes with jinja2.exceptions.UndefinedError

Issue #329 resolved
RogerHaase
created an issue

At moin2 tip, foobar theme crashes trying to access home page. Modernized theme works OK.

    jinja2.exceptions.UndefinedError

    UndefinedError: 'MoinMoin.search.SearchForm object' has no attribute 'submit'
    Traceback (most recent call last)

        File "C:\Bitbucket\m2-x7\env\lib\site-packages\flask\app.py", line 1701, in __call__

        return self.wsgi_app(environ, start_response)

        File "C:\Bitbucket\m2-x7\env\lib\site-packages\flask\app.py", line 1689, in wsgi_app

        response = self.make_response(self.handle_exception(e))

        File "C:\Bitbucket\m2-x7\env\lib\site-packages\flask\app.py", line 1687, in wsgi_app

        response = self.full_dispatch_request()

        File "C:\Bitbucket\m2-x7\env\lib\site-packages\flask\app.py", line 1360, in full_dispatch_request

        rv = self.handle_user_exception(e)

        File "C:\Bitbucket\m2-x7\env\lib\site-packages\flask\app.py", line 1358, in full_dispatch_request

        rv = self.dispatch_request()

        File "C:\Bitbucket\m2-x7\env\lib\site-packages\flask\app.py", line 1344, in dispatch_request

        return self.view_functions[rule.endpoint](**req.view_args)

        File "c:\bitbucket\m2-x7\MoinMoin\apps\frontend\views.py", line 353, in show_item

        return item.do_show(rev)

        File "c:\bitbucket\m2-x7\MoinMoin\items\__init__.py", line 690, in do_show

        show_navigation=show_navigation,

        File "c:\bitbucket\m2-x7\MoinMoin\util\clock.py", line 62, in wrapper

        retval = f(*args, **kw)

        File "c:\bitbucket\m2-x7\MoinMoin\themes\__init__.py", line 52, in render_template

        return render_theme_template(get_current_theme(), template, **context)

        File "C:\Bitbucket\m2-x7\env\lib\site-packages\flaskext\themes.py", line 472, in render_theme_template

        **context)

        File "C:\Bitbucket\m2-x7\env\lib\site-packages\flask\templating.py", line 125, in render_template

        context, ctx.app)

        File "C:\Bitbucket\m2-x7\env\lib\site-packages\flask\templating.py", line 107, in _render

        rv = template.render(context)

        File "C:\Bitbucket\m2-x7\env\lib\site-packages\jinja2\environment.py", line 894, in render

        return self.environment.handle_exception(exc_info, True)

        File "c:\bitbucket\m2-x7\MoinMoin\themes\foobar\templates\show.html", line 1, in top-level template code

        {% extends theme("layout.html") %}

        File "c:\bitbucket\m2-x7\MoinMoin\themes\foobar\templates\layout.html", line 12, in top-level template code

        {% set credits = snippets.credits() %}

        File "c:\bitbucket\m2-x7\MoinMoin\templates\base.html", line 52, in top-level template code

        {% block layout %}

        File "c:\bitbucket\m2-x7\MoinMoin\themes\foobar\templates\layout.html", line 110, in block "layout"

        {{ gen.button(search_form['submit'], type='submit', id='moin-search-submit') }}

        File "C:\Bitbucket\m2-x7\env\lib\site-packages\flatland\out\markup.py", line 289, in __call__

        header = self._open(bind, attributes)

        File "C:\Bitbucket\m2-x7\env\lib\site-packages\flatland\out\markup.py", line 262, in _open

        tagname, attributes, contents, self._context, bind)

        File "C:\Bitbucket\m2-x7\env\lib\site-packages\flatland\out\generic.py", line 18, in transform

        contents = fn(tagname, attributes, contents, context, bind)

        File "C:\Bitbucket\m2-x7\env\lib\site-packages\flatland\out\generic.py", line 108, in transform_name

        bound_name = bind.flattened_name()

        UndefinedError: 'MoinMoin.search.SearchForm object' has no attribute 'submit'