From 76d7409830d87b1396eca8f2db1ef7a8104fa29e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Norman=20J=C3=A4ckel?= Date: Sat, 11 May 2013 14:27:46 +0200 Subject: [PATCH] Change version view. New way to get name and version from plugins. --- openslides/core/templates/core/version.html | 4 ++- openslides/core/views.py | 27 ++++++++++++++++----- 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/openslides/core/templates/core/version.html b/openslides/core/templates/core/version.html index ee118188c..b83508bcc 100644 --- a/openslides/core/templates/core/version.html +++ b/openslides/core/templates/core/version.html @@ -6,7 +6,9 @@ {% block content %}

{% trans 'Version' %}

+ {% endblock %} diff --git a/openslides/core/views.py b/openslides/core/views.py index 8d0384deb..b33a91113 100644 --- a/openslides/core/views.py +++ b/openslides/core/views.py @@ -19,7 +19,7 @@ from openslides.utils.views import TemplateView class VersionView(TemplateView): """ - Show version infos. + Shows version infos. """ template_name = 'core/version.html' @@ -32,20 +32,35 @@ class VersionView(TemplateView): # OpenSlides version. During development the git commit id is added. openslides_version_string = get_version() if not RELEASE: - openslides_version_string += ' Commit: %s' % get_git_commit_id() + openslides_version_string += ' – Commit %s' % get_git_commit_id() context['versions'] = [('OpenSlides', openslides_version_string)] # Versions of plugins. for plugin in settings.INSTALLED_PLUGINS: + # Get plugin try: mod = import_module(plugin) - plugin_version = get_version(mod.VERSION) - except (ImportError, AttributeError, AssertionError): + except ImportError: continue + + # Get version. try: - plugin_name = mod.NAME + plugin_version = mod.get_version() except AttributeError: - plugin_name = mod.__name__.split('.')[0] + try: + plugin_version = mod.VERSION + except AttributeError: + continue + + # Get name. + try: + plugin_name = mod.get_name() + except AttributeError: + try: + plugin_name = mod.NAME + except AttributeError: + plugin_name = mod.__name__.split('.')[0] + context['versions'].append((plugin_name, plugin_version)) return context