Added inner package name in static configuration to complete displayed application version
authorThierry Florac <thierry.florac@onf.fr>
Tue, 11 Apr 2017 10:21:54 +0200
changeset 197 710c4a7e2546
parent 196 bbeb090d73e9
child 198 96b8eecdaabb
Added inner package name in static configuration to complete displayed application version
src/ztfy/myams/configuration.py
src/ztfy/myams/interfaces/configuration.py
--- a/src/ztfy/myams/configuration.py	Tue Apr 11 10:17:09 2017 +0200
+++ b/src/ztfy/myams/configuration.py	Tue Apr 11 10:21:54 2017 +0200
@@ -37,7 +37,11 @@
 
     application_package = 'ztfy.myams'
     application_name = u'MyAMS'
+    inner_package = None
+    inner_package_name = None
+
     version_location = u'menus'
+
     include_top_links = True
     include_site_search = True
     include_mobile_search = True
@@ -53,7 +57,11 @@
 
     @property
     def version(self):
-        return pkg_resources.get_distribution(self.application_package).version
+        result = pkg_resources.get_distribution(self.application_package).version
+        if self.inner_package:
+            result += ' (%s v%s)' % (self.inner_package_name,
+                                     pkg_resources.get_distribution(self.inner_package).version)
+        return result
 
 
 class MyAMSConfiguration(Persistent, Contained):
--- a/src/ztfy/myams/interfaces/configuration.py	Tue Apr 11 10:17:09 2017 +0200
+++ b/src/ztfy/myams/interfaces/configuration.py	Tue Apr 11 10:21:54 2017 +0200
@@ -34,6 +34,14 @@
                                 description=_("This name is used to display application version"),
                                 required=False)
 
+    inner_package = TextLine(title=_("Inner package"),
+                             description=_("This is another important package displayed in application version"),
+                             required=False)
+
+    inner_package_name = TextLine(title=_("Inner package name"),
+                                  description=_("Package name used to display application version"),
+                                  required=False)
+
     version = Attribute(_("Application version"))
 
     version_location = Choice(title=_("Version location"),