Skip to content

Commit b4a9e72

Browse files
committed
Use static value for showing git revision, not subprocess (SEA-1484)
Calling subprocess shall be avoided if at all possible
1 parent 94a2488 commit b4a9e72

File tree

6 files changed

+9
-42
lines changed

6 files changed

+9
-42
lines changed

development.ini.example

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ retry.attempts = 3
4545
# debugtoolbar.hosts = 127.0.0.1 ::1
4646

4747

48+
# Generated by puppet
49+
git_revision = 1234
50+
51+
4852
# Set your own path here where the files are stored
4953

5054
documents_dir = files

src/privatim/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,9 @@ def profile_pic(request: 'IRequest') -> str:
9090

9191
config.add_request_method(MessageQueue, 'messages', reify=True)
9292

93+
rev = settings.get('git_revision', '')
94+
config.add_request_method(lambda r: rev, 'git_revision', reify=True)
95+
9396
def add_action_menu_entries(
9497
request: 'IRequest',
9598
entries: Iterable['Button'],

src/privatim/git_info.py

Lines changed: 0 additions & 22 deletions
This file was deleted.

src/privatim/helpers.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,4 @@
66
# https://docs.pylonsproject.org/projects/pyramid_cookbook/en/latest
77
# /templates/templates.html
88

9-
from privatim.git_info import get_git_revision_hash
109
from markupsafe import Markup # noqa: F401
11-
12-
13-
git_revision = get_git_revision_hash()

src/privatim/layouts/footer.pt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@
1515
<h5 i18n:translate="" class="text-uppercase mb-md-3">
1616
Version
1717
</h5>
18-
<span tal:condition="h.git_revision"
18+
<span tal:condition="request.git_revision"
1919
data-bs-toggle="tooltip" data-bs-placement="bottom" i18n:attributes="title"
2020
title="Version of the software (Git revision number)">
2121
<span>Versionsnummer:</span>
2222
<span>
23-
${h.git_revision}
23+
${request.git_revision}
2424
</span>
2525
</span>
2626
</div>

src/privatim/tweens.py

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)