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