Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding nesting blueprints #1301

Closed
TheGrandmother opened this issue Aug 29, 2018 · 2 comments
Closed

Adding nesting blueprints #1301

TheGrandmother opened this issue Aug 29, 2018 · 2 comments

Comments

@TheGrandmother
Copy link

Is it possible to add a blueprint to a blueprint?
I want to be able to do the following:

import dataset_bp
bp = Blueprint('process_leafs', url_prefix='process_leafs')
# Stuff
bp.blueprint(dataset_bp, url_prefix='/<uuid>/dataset')

in order to be be to use the endpoint /process_leafs/420/dataset

Afaik there is no such feature.
I think this would be really really nice to have.
Since it is not only neat but it would enable code reuse, since for example many resources in the API might also have datasets as per this example.

Right now I'm going to do this through some light workarounding but it would be a glorious feature.

@TheGrandmother
Copy link
Author

Hmmm.... apparently something like this exists in the code:
https://github.com/channelcat/sanic/blob/30e6a310f132752669a74927530e8bc52a51e98e/sanic/blueprints.py#L41

But it is not mentioned in the docs. Will look into it and update the documentation.

@TheGrandmother
Copy link
Author

This is possible to do via the group method.
Is the docs pointing to the wrong version related to #1245 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant