Except handling for 'Git not found' in about page
This commit is contained in:
+14
-4
@@ -86,15 +86,25 @@ def logout_view(request, *args, **kwargs):
|
||||
@require_http_methods(["GET"])
|
||||
def about_view(request, *args, **kwargs):
|
||||
"""Render about page."""
|
||||
repo = git.init_repo()
|
||||
latest_commit = repo.git("rev-parse HEAD").decode('utf-8')
|
||||
latest_date = repo.git("show -s --format=%ci " + latest_commit).decode('utf-8')
|
||||
latest_tag = repo.git("describe --tags " + repo.git("rev-list --tags --max-count=1").decode('utf-8')).decode('utf-8')
|
||||
|
||||
latest_commit = "Not found"
|
||||
latest_date = "Not found"
|
||||
latest_tag = "Not found"
|
||||
|
||||
try:
|
||||
repo = git.init_repo()
|
||||
latest_commit = repo.git("rev-parse HEAD").decode('utf-8')
|
||||
latest_date = repo.git("show -s --format=%ci " + latest_commit).decode('utf-8')
|
||||
latest_tag = repo.git("describe --tags " + repo.git("rev-list --tags --max-count=1").decode('utf-8')).decode('utf-8')
|
||||
except:
|
||||
pass
|
||||
|
||||
context = {
|
||||
'commit': latest_commit,
|
||||
'date': latest_date,
|
||||
'tag': latest_tag
|
||||
}
|
||||
|
||||
return render(request, "about.html", context)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user