mirror of
https://github.com/LukeHagar/pypistats.org.git
synced 2025-12-06 12:47:48 +00:00
fix for packages with . in name
This commit is contained in:
@@ -26,6 +26,7 @@ def api():
|
|||||||
@blueprint.route("/packages/<package>/recent")
|
@blueprint.route("/packages/<package>/recent")
|
||||||
def api_downloads_recent(package):
|
def api_downloads_recent(package):
|
||||||
"""Get the recent downloads of a package."""
|
"""Get the recent downloads of a package."""
|
||||||
|
package = package.replace(".", "-")
|
||||||
category = request.args.get('period')
|
category = request.args.get('period')
|
||||||
if category is None:
|
if category is None:
|
||||||
downloads = RecentDownloadCount.query.\
|
downloads = RecentDownloadCount.query.\
|
||||||
@@ -53,6 +54,7 @@ def api_downloads_recent(package):
|
|||||||
@blueprint.route("/packages/<package>/overall")
|
@blueprint.route("/packages/<package>/overall")
|
||||||
def api_downloads_overall(package):
|
def api_downloads_overall(package):
|
||||||
"""Get the overall download time series of a package."""
|
"""Get the overall download time series of a package."""
|
||||||
|
package = package.replace(".", "-")
|
||||||
mirrors = request.args.get('mirrors')
|
mirrors = request.args.get('mirrors')
|
||||||
if mirrors == 'true':
|
if mirrors == 'true':
|
||||||
downloads = OverallDownloadCount.query.\
|
downloads = OverallDownloadCount.query.\
|
||||||
@@ -104,6 +106,7 @@ def api_downloads_system(package):
|
|||||||
|
|
||||||
def generic_downloads(model, package, arg, name):
|
def generic_downloads(model, package, arg, name):
|
||||||
"""Generate a generic response."""
|
"""Generate a generic response."""
|
||||||
|
package = package.replace(".", "-")
|
||||||
category = request.args.get(arg)
|
category = request.args.get(arg)
|
||||||
if category is not None:
|
if category is not None:
|
||||||
downloads = model.query.\
|
downloads = model.query.\
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ def index():
|
|||||||
@blueprint.route("/search/<package>", methods=("GET", "POST"))
|
@blueprint.route("/search/<package>", methods=("GET", "POST"))
|
||||||
def search(package):
|
def search(package):
|
||||||
"""Render the home page."""
|
"""Render the home page."""
|
||||||
|
package = package.replace(".", "-")
|
||||||
form = MyForm()
|
form = MyForm()
|
||||||
if form.validate_on_submit():
|
if form.validate_on_submit():
|
||||||
package = form.name.data
|
package = form.name.data
|
||||||
@@ -91,6 +92,7 @@ def faqs():
|
|||||||
@blueprint.route("/packages/<package>")
|
@blueprint.route("/packages/<package>")
|
||||||
def package(package):
|
def package(package):
|
||||||
"""Render the package page."""
|
"""Render the package page."""
|
||||||
|
package = package.replace(".", "-")
|
||||||
# Recent download stats
|
# Recent download stats
|
||||||
recent_downloads = RecentDownloadCount.query.\
|
recent_downloads = RecentDownloadCount.query.\
|
||||||
filter_by(package=package).all()
|
filter_by(package=package).all()
|
||||||
|
|||||||
Reference in New Issue
Block a user