Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Nested blueprints#3923

Merged
davidism merged 1 commit intopallets:masterfrom
pgjones:nested
Apr 14, 2021
Merged

Nested blueprints#3923
davidism merged 1 commit intopallets:masterfrom
pgjones:nested

Conversation

@pgjones
Copy link
Member

@pgjonespgjones commentedFeb 24, 2021
edited by davidism
Loading

This allows blueprints to be nested within blueprints via a new
Blueprint.register_blueprint method. This should provide a use case
that has been desired for the past ~10 years.

This works by setting the endpoint name to be the blueprint names,
from parent to child delimeted by "." and then iterating over the
blueprint names in reverse order in the app (from most specific to
most general). This means that the expectation of nesting a blueprint
within a nested blueprint is met.

Checklist:

  • Add tests that demonstrate the correct behavior of the change. Tests should fail without the change.
  • Add or update relevant docs, in the docs folder and in code.
  • Add an entry inCHANGES.rst summarizing the change and linking to the issue.
  • Add.. versionchanged:: entries in any relevant code docs.
  • Runpre-commit hooks and fix any issues.
  • Runpytest andtox, no tests failed.

greyli, Abdur-rahmaanJ, Demetriex, jonathanmach, anthonyatp, nilleb, jackwardell, gricey432, and russomi reacted with thumbs up emojihXtreme and russomi reacted with heart emojiAkramElOmrani, jackwardell, svieira, and russomi reacted with rocket emojiazmeuk and russomi reacted with eyes emoji
@greyligreyli linked an issueFeb 25, 2021 that may beclosed by this pull request
@Abdur-rahmaanJ
Copy link
Contributor

Building theShopyo framework which makes use of this idea (not for nested but normal blueprints), i posed the question of infinity.

It is better expressed inThiefMaster's words: "Wouldn't a proper implementation of "sub-blueprints" pretty much automatically support infinite nesting of blueprints, too, anyway?" How does this PR address the issue?

@pgjones
Copy link
MemberAuthor

@Abdur-rahmaanJ This supports infinite nesting, subject to resource limitations, so I don't think there is an issue.

Abdur-rahmaanJ reacted with heart emoji

@davidismdavidismforce-pushed thenested branch 3 times, most recently from2684eea to7c60412CompareMarch 10, 2021 19:14
@pgjonespgjones changed the titleWIP: Nested blueprintsNested blueprintsApr 7, 2021
@pgjonespgjones marked this pull request as ready for reviewApril 7, 2021 19:34
@pgjones
Copy link
MemberAuthor

I'm not sure if any additional documentation is required, as the nesting should work as a user would expect - therefore I think it is best just to note that nesting is possible.

This allows blueprints to be nested within blueprints via a newBlueprint.register_blueprint method. This should provide a use casethat has been desired for the past ~10 years.This works by setting the endpoint name to be the blueprint names,from parent to child delimeted by "." and then iterating over theblueprint names in reverse order in the app (from most specific tomost general). This means that the expectation of nesting a blueprintwithin a nested blueprint is met.
@davidism
Copy link
Member

I added a few more lines of documentation mentioning that URL prefixes are applied like/parent/child/route, parent before request etc. functions apply to the child, and child error handlers are preferred over parent.

@davidismdavidism merged commit64213fc intopallets:masterApr 14, 2021
@pgjonespgjones deleted the nested branchApril 14, 2021 16:34
@pgjones
Copy link
MemberAuthor

🎉

davidism, jackwardell, Abdur-rahmaanJ, hXtreme, and ramnes reacted with hooray emoji

@jackwardell
Copy link
Contributor

so exciting, great work 👏

Abdur-rahmaanJ reacted with thumbs up emoji

@hXtreme
Copy link

This is the day I've been waiting for!🎉

Abdur-rahmaanJ reacted with thumbs up emoji

@github-actionsgithub-actionsbot locked asresolvedand limited conversation to collaboratorsApr 29, 2021
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.

Reviewers

No reviews

Assignees

No one assigned

Labels

Projects

None yet

Milestone

2.0.0

Development

Successfully merging this pull request may close these issues.

Support zero-ceremony sub-app mounting (including Blueprints) Nestable blueprints

5 participants

@pgjones@Abdur-rahmaanJ@davidism@jackwardell@hXtreme

Comments


[8]ページ先頭

©2009-2026 Movatter.jp