inveniosoftware / inveniosoftware/flask-breadcrumbs

Error with paths, blueprint and more than one route

Open
#43 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
30
Forks
24
PR merge metrics
No merged PRs in 30d

Description

Hi,

I currently using Flask-Menu to make the menu of my app, and now i want to use Flask-Breadcrumbs to make it more usable but i have a problem.

I changed all decorators of "register_menu" for "register_breadcrumbs" and the menu breaks.

In a app.py i have the base menu like this:
```
from flask import Flask, render_template
from flask_breadcrumbs import Breadcrumbs, register_breadcrumb

app = Flask(__name__)
Breadcrumbs(app)

@register_breadcrumb(app, '.', 'Home')
@register_breadcrumb(app, '.first', 'First', order=0)
@register_breadcrumb(app, '.second', 'Second', order=1)
@app.route('/')
def index(): return render_template('index.html')

# Loading views
resources_dir = 'views'
import views
for importer, package_name, _ in pkgutil.iter_modules(views.__path__):
module = importer.find_module(package_name).load_module('%s.%s' % (resources_dir, package_name))
if hasattr(module, 'bp'):
try:
app.register_blueprint(getattr(module, 'bp'))
except Exception, e:
pass

```
In my template i have this code
```


```

And i see this breadcrumb
![image](https://cloud.githubusercontent.com/assets/3129660/25709253/18f52e70-30e9-11e7-8489-3450ac1fdb98.png)

As you can see, i have two entris with "Menu item not initialised"

In one of these views i have more child entris of ".erp" submenu that cause this missfunction

```
@register_breadcrumb(bp, '.erp.config', 'Config')
@register_breadcrumb(bp, '.erp.exec', 'Exec')
@register_breadcrumb(bp, '.erp.report', 'Reports')
@bp.route('/' )
```

Can you help me?

King regards

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.