Fix release rendering when package has a dash
Committed 58b5e2
--- a/webint_code/__init__.py
+++ b/webint_code/__init__.py
def get_project_from_name(db, name):
"""Return the project associated with project name."""
try:
- return db.select("projects", where="name = ?", vals=[name])[0].replace("-", "_")
+ return db.select("projects", where="name = ?", vals=[name])[0]
except IndexError:
return None
def get(self, project, release):
"""Return a view of the package file."""
- pypi_name = app.model.get_project_from_name(project)["pypi"]
+ pypi_name = app.model.get_project_from_name(project)["pypi"].replace("-", "_")
files = sorted(
(code_dir / project / "releases" / f"{pypi_name}-{release}").iterdir()
)
def get(self, project, release, filename=""):
"""Return a view of the release's file."""
- pypi_name = app.model.get_project_from_name(project)["pypi"]
+ pypi_name = app.model.get_project_from_name(project)["pypi"].replace("-", "_")
filepath = code_dir / project / "releases" / f"{pypi_name}-{release}" / filename
try:
with filepath.open() as fp: