-
-
Notifications
You must be signed in to change notification settings - Fork 182
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor sample image data generation
- Loading branch information
1 parent
dabf7e5
commit 3e50d16
Showing
2 changed files
with
16 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,14 @@ | ||
from flask import Blueprint, current_app as app, render_template | ||
from flask import Blueprint, render_template | ||
from flask_api.decorators import set_renderers | ||
from flask_api.renderers import HTMLRenderer | ||
|
||
from ._common import url_for | ||
from ._common import samples | ||
|
||
|
||
blueprint = Blueprint('overview', __name__, url_prefix="/overview") | ||
|
||
|
||
def _gen(): | ||
for template in sorted(app.template_service.all()): | ||
path = template.sample_path | ||
url = url_for("image.get", key=template.key, path=path, _external=True) | ||
link = url_for("links.get", key=template.key, path=path) | ||
yield { | ||
'url': url, | ||
'link': link | ||
} | ||
|
||
|
||
@blueprint.route("") | ||
@set_renderers(HTMLRenderer) | ||
def get(): | ||
return render_template('overview.html', imgs=_gen()) | ||
return render_template('overview.html', imgs=samples()) |