fix: add null menu handler, for use with API apps

This commit is contained in:
Lance Edgar 2024-07-15 21:51:45 -05:00
parent 57fdacdb83
commit be6eb5f815

View file

@ -745,3 +745,18 @@ class MenuHandler(TailboneMenuHandler):
"please use tailbone.menus.TailboneMenuHandler instead",
DeprecationWarning, stacklevel=2)
super().__init__(*args, **kwargs)
class NullMenuHandler(WuttaMenuHandler):
"""
Null menu handler which uses an empty menu set.
.. note:
This class shouldn't even exist, but for the moment, it is
useful to configure non-traditional (e.g. API) web apps to use
this, in order to avoid most of the overhead.
"""
def make_menus(self, request, **kwargs):
return []