From 1c2359e2c11f6efa4d62ba4d260848b3c8e37ead Mon Sep 17 00:00:00 2001 From: Radi85 Date: Mon, 7 Dec 2020 10:43:49 +0100 Subject: [PATCH] fix(#114): fix version issue closes #114 --- VERSION | 2 +- comment/__init__.py | 16 +++++++++++++++- comment/urls.py | 4 ++-- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/VERSION b/VERSION index fad066f..4fd0fe3 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.5.0 \ No newline at end of file +2.5.1 \ No newline at end of file diff --git a/comment/__init__.py b/comment/__init__.py index 3424d55..1d47a75 100644 --- a/comment/__init__.py +++ b/comment/__init__.py @@ -1,5 +1,7 @@ import os +__version__ = '2.5.1' + def _get_version(): _parent_project_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) @@ -12,5 +14,17 @@ def _get_version(): return version -__version__ = _get_version() +def check_release(): + release = None + try: + release = _get_version() + except (FileNotFoundError, Exception): + pass + if release: + assert release == __version__, 'Current version does not match with manifest VERSION' + + +check_release() + + default_app_config = 'comment.apps.CommentConfig' diff --git a/comment/urls.py b/comment/urls.py index 87ada02..728d4f4 100644 --- a/comment/urls.py +++ b/comment/urls.py @@ -2,7 +2,7 @@ from django.views.decorators.cache import cache_page from django.views.i18n import JavaScriptCatalog -from comment import _get_version +from comment import __version__ from comment.views import ( CreateComment, UpdateComment, DeleteComment, SetReaction, SetFlag, ChangeFlagState, ConfirmComment) @@ -22,6 +22,6 @@ # The value returned by _get_version() must change when translations change. path( 'jsi18n/', - cache_page(86400, key_prefix='js18n-%s' % _get_version())(JavaScriptCatalog.as_view()), + cache_page(86400, key_prefix='js18n-%s' % __version__)(JavaScriptCatalog.as_view()), name='javascript-catalog'), ]