Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
schilder2000
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
schilder
schilder2000
Commits
dfac9164
Commit
dfac9164
authored
9 months ago
by
Thomas Schneider
Browse files
Options
Downloads
Patches
Plain Diff
helpers: Blueprint.render_template: factor out real_template_name()
parent
a687076b
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
schilder2000/helpers.py
+10
-4
10 additions, 4 deletions
schilder2000/helpers.py
with
10 additions
and
4 deletions
schilder2000/helpers.py
+
10
−
4
View file @
dfac9164
...
@@ -6,10 +6,8 @@ from jinja2 import BaseLoader, ChoiceLoader, PrefixLoader, Template
...
@@ -6,10 +6,8 @@ from jinja2 import BaseLoader, ChoiceLoader, PrefixLoader, Template
class
Blueprint
(
FlaskBlueprint
):
class
Blueprint
(
FlaskBlueprint
):
def
render_template
(
def
real_template_name
(
self
,
self
,
template
:
str
|
Template
|
list
[
str
|
Template
]
template
:
str
|
Template
|
list
[
str
|
Template
],
**
context
:
t
.
Any
,
)
->
str
:
)
->
str
:
if
self
.
jinja_loader
is
not
None
:
if
self
.
jinja_loader
is
not
None
:
# XXX This currently assumes ":" as PrefixLoader.delimiter in the app
# XXX This currently assumes ":" as PrefixLoader.delimiter in the app
...
@@ -19,6 +17,14 @@ class Blueprint(FlaskBlueprint):
...
@@ -19,6 +17,14 @@ class Blueprint(FlaskBlueprint):
for
i
,
tpl
in
enumerate
(
template
):
for
i
,
tpl
in
enumerate
(
template
):
if
isinstance
(
t
,
str
)
and
"
:
"
not
in
tpl
:
if
isinstance
(
t
,
str
)
and
"
:
"
not
in
tpl
:
template
[
i
]
=
self
.
name
+
"
:
"
+
tpl
template
[
i
]
=
self
.
name
+
"
:
"
+
tpl
return
template
def
render_template
(
self
,
template
:
str
|
Template
|
list
[
str
|
Template
],
**
context
:
t
.
Any
,
)
->
str
:
template
=
self
.
real_template_name
(
template
)
return
render_template
(
template
,
**
context
)
return
render_template
(
template
,
**
context
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment