From 523176ee51571699a539770bda1aba74e0858721 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Fri, 22 Jun 2012 11:38:36 +0200 Subject: [PATCH] set pandora.site.site.version and show on /software, fixes #866 --- pandora/app/config.py | 11 +++++++++++ static/js/pandora/siteDialog.0xdb.js | 1 + static/js/pandora/siteDialog.js | 1 + 3 files changed, 13 insertions(+) diff --git a/pandora/app/config.py b/pandora/app/config.py index c34cca1ce..b492a0287 100644 --- a/pandora/app/config.py +++ b/pandora/app/config.py @@ -19,6 +19,16 @@ _win = (sys.platform == "win32") RUN_RELOADER = True +def get_version(): + info = os.path.join(os.path.dirname(__file__), '..', '..', '.bzr/branch/last-revision') + if os.path.exists(info): + f = open(info) + rev = int(f.read().split()[0]) + f.close() + if rev: + return u'%s' % rev + return u'unknown' + def load_config(): with open(settings.SITE_CONFIG) as f: try: @@ -33,6 +43,7 @@ def load_config(): settings.DEFAULT_FROM_EMAIL = config['site']['email']['system'] settings.SERVER_EMAIL = config['site']['email']['system'] config['site']['videoprefix'] = settings.VIDEO_PREFIX + config['site']['version'] = get_version() config['keys'] = {} for key in config['itemKeys']: diff --git a/static/js/pandora/siteDialog.0xdb.js b/static/js/pandora/siteDialog.0xdb.js index c9f2e7d9c..86d1005e5 100644 --- a/static/js/pandora/siteDialog.0xdb.js +++ b/static/js/pandora/siteDialog.0xdb.js @@ -28,6 +28,7 @@ pandora.ui.siteDialog = function(section) { + '

To learn more about pan.do/ra and OxJS, ' + 'please visit pan.do/ra ' + 'and oxjs.org.

' + + '' + pandora.site.site.name + ' is running pan.do/ra r'+ pandora.site.site.version ) .appendTo($content); } else { diff --git a/static/js/pandora/siteDialog.js b/static/js/pandora/siteDialog.js index de65a6833..bb5a9cd54 100644 --- a/static/js/pandora/siteDialog.js +++ b/static/js/pandora/siteDialog.js @@ -28,6 +28,7 @@ pandora.ui.siteDialog = function(section) { + '

To learn more about pan.do/ra and OxJS, ' + 'please visit pan.do/ra ' + 'and oxjs.org.

' + + '' + pandora.site.site.name + ' is running pan.do/ra r'+ pandora.site.site.version ) .appendTo($content); } else {