mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2024-11-24 10:34:01 +03:00
1674cecc8d
* Add a piece of the tutorial * Add "Make it pretty" tutorial step * Add section about github client setup * Make minor fixes * Add search service section + table of contents * Make various fixes * Make more fixes * Update make the search section * Update ghnav-flask example & README * Update base.html markup * Finish section: Make the search work * Update ghnav-flask screenshot * Update tutorials * Add flaks tutorial link to the DI in Python page
24 lines
526 B
Python
24 lines
526 B
Python
"""Views module."""
|
|
|
|
from flask import request, render_template
|
|
|
|
from .services import SearchService
|
|
|
|
|
|
def index(
|
|
search_service: SearchService,
|
|
default_query: str,
|
|
default_limit: int,
|
|
):
|
|
query = request.args.get('query', default_query)
|
|
limit = request.args.get('limit', default_limit, int)
|
|
|
|
repositories = search_service.search_repositories(query, limit)
|
|
|
|
return render_template(
|
|
'index.html',
|
|
query=query,
|
|
limit=limit,
|
|
repositories=repositories,
|
|
)
|