wuttaweb.handler
¶
Web Handler
- class wuttaweb.handler.WebHandler(config)[source]¶
Base class and default implementation for the web handler.
This is responsible for determining the menu handler and various other customizations.
- get_fanstatic_url(request, resource)[source]¶
Returns the full URL to the given Fanstatic resource.
- Parameters:
request – Current request object.
resource –
fanstatic.Resource
instance representing an image file or other resource.
- get_favicon_url(request)[source]¶
Returns the canonical app favicon image URL.
This will return the fallback favicon from WuttaWeb unless config specifies an override:
[wuttaweb] favicon_url = http://example.com/favicon.ico
- get_header_logo_url(request)[source]¶
Returns the canonical app header image URL.
This will return the value from config if specified (as shown below); otherwise it will just call
get_favicon_url()
and return that.[wuttaweb] header_logo_url = http://example.com/logo.png
- get_main_logo_url(request)[source]¶
Returns the canonical app logo image URL.
This will return the fallback logo from WuttaWeb unless config specifies an override:
[wuttaweb] logo_url = http://example.com/logo.png
Get the configured menu handler for the web app.
Specify a custom handler in your config file like this:
[wutta.web] menus.handler.spec = poser.web.menus:PoserMenuHandler
- Returns:
Instance of
MenuHandler
.
Get the spec strings for all available menu handlers. See also
get_menu_handler()
.- Parameters:
default – Default spec string(s) to include, even if not registered. Can be a string or list of strings.
- Returns:
List of menu handler spec strings.
This will gather available spec strings from the following:
First, the
default
as provided by caller.Second, the default spec from config, if set; for example:
[wutta.web] menus.handler.default_spec = poser.web.menus:PoserMenuHandler
Third, each spec registered via entry points. For instance in
pyproject.toml
:[project.entry-points."wutta.web.menus"] poser = "poser.web.menus:PoserMenuHandler"
The final list will be “sorted” according to the above, with the latter registered handlers being sorted alphabetically.