From be6eb5f8153e373772278f2786aa72b0c15f8daf Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Mon, 15 Jul 2024 21:51:45 -0500 Subject: [PATCH] fix: add null menu handler, for use with API apps --- tailbone/menus.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tailbone/menus.py b/tailbone/menus.py index 84c12343..abd0b58b 100644 --- a/tailbone/menus.py +++ b/tailbone/menus.py @@ -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 []