inveniosoftware / inveniosoftware/flask-breadcrumbs
global: check for extension initialization before registering breadcrumb
- Dominant language
- Python
- Stars
- 30
- Forks
- 24
- PR merge metrics
- No merged PRs in 30d
Description
There are scenarios where some flask extension might want to provide `Flask-Breadcrumbs` capabilities for its blueprints, but the user of the extension is not interested in this (e.g. if the application doesn't have any UI views, but only provides a REST API).
It should be possible to conditionally register the breadcrumb, by checking if `current_breadcrumbs` exists before performing the registration:
```python
# inside "register_breadcrumb"
...
def breadcrumb_decorator(func):
"""Applie standard menu decorator and assign breadcrumb."""
if current_breadcrumbs:
func.__breadcrumb__ = func_path
return menu_decorator(func)
...
```
(this change depends on https://github.com/inveniosoftware/flask-menu/issues/65)
Contributor guide
Research direction
Start by locating register_breadcrumb and review the linked flask-menu issue 65, since this change depends on it. Confirm how current_breadcrumbs is exposed before deciding where the conditional check belongs; done means breadcrumb registration can be skipped when it is unavailable while existing registration still works.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- flask, python
- Domain
- web-dev
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100