mirror of https://git.sr.ht/~sircmpwn/hub.sr.ht
Show friendlier error on failure to fetch README.md
This commit is contained in:
parent
929af677f1
commit
adaabb8031
|
@ -15,10 +15,15 @@ def summary_GET(owner, project_name):
|
|||
owner, project = get_project(owner, project_name, ProjectAccess.read)
|
||||
|
||||
summary = None
|
||||
summary_error = False
|
||||
if project.summary_repo_id is not None:
|
||||
repo = project.summary_repo
|
||||
assert repo.repo_type != RepoType.hg # TODO
|
||||
summary = git.get_readme(owner, repo.name)
|
||||
try:
|
||||
summary = git.get_readme(owner, repo.name)
|
||||
except:
|
||||
summary = None
|
||||
summary_error = True
|
||||
|
||||
events = (Event.query
|
||||
.filter(Event.project_id == project.id)
|
||||
|
@ -26,7 +31,8 @@ def summary_GET(owner, project_name):
|
|||
.limit(2)).all()
|
||||
|
||||
return render_template("project-summary.html", view="summary",
|
||||
owner=owner, project=project, summary=summary,
|
||||
owner=owner, project=project,
|
||||
summary=summary, summary_error=summary_error,
|
||||
events=events, EventType=EventType)
|
||||
|
||||
@projects.route("/<owner>/<project_name>/feed")
|
||||
|
|
|
@ -110,7 +110,8 @@
|
|||
<div class="row">
|
||||
{% if project.summary_repo_id != None %}
|
||||
<div class="col-md-10">
|
||||
{% if current_user and current_user.id == project.owner_id and not summary %}
|
||||
{% if current_user and current_user.id == project.owner_id
|
||||
and not summary and not summary_error %}
|
||||
<div class="alert alert-danger">
|
||||
<strong>Head's up!</strong> This project is configured to use
|
||||
"<code>README.md</code>" from
|
||||
|
@ -125,7 +126,13 @@
|
|||
>choose a different repository</a>.
|
||||
</div>
|
||||
{% else %}
|
||||
{% if not summary_error %}
|
||||
{{summary | extended_md}}
|
||||
{% else %}
|
||||
<div class="alert alert-danger">
|
||||
An internal error occured fetching the README.md for this project.
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</div>
|
||||
{% elif current_user and current_user.id == project.owner_id %}
|
||||
|
|
Loading…
Reference in New Issue