Remove unused "simple menus" module approach

now we always use a handler instead
This commit is contained in:
Lance Edgar 2023-10-29 15:46:18 -05:00
parent da13254caa
commit c1f2f84c7f

View file

@ -29,7 +29,7 @@ import logging
import warnings import warnings
from rattail.app import GenericHandler from rattail.app import GenericHandler
from rattail.util import import_module_path, prettify, simple_error from rattail.util import prettify, simple_error
from webhelpers2.html import tags, HTML from webhelpers2.html import tags, HTML
@ -70,19 +70,7 @@ class MenuHandler(GenericHandler):
tags.link_to("Menu Config", request.route_url('configure_menus')))) tags.link_to("Menu Config", request.route_url('configure_menus'))))
request.session.flash(msg, 'warning') request.session.flash(msg, 'warning')
# okay, no config, so menus must be built from code.. # okay, no config, so menus will be built from code
# first check for a "simple menus" module; use that if defined
menumod = self.config.get('tailbone', 'menus')
if menumod:
menumod = import_module_path(menumod)
if (not hasattr(menumod, 'simple_menus')
or not callable(menumod.simple_menus)):
raise RuntimeError("module does not have a simple_menus() "
"callable: {}".format(menumod))
return menumod.simple_menus(request)
# now we fallback to menu handler method
return self.make_menus(request) return self.make_menus(request)
def make_menus_from_config(self, request, **kwargs): def make_menus_from_config(self, request, **kwargs):