From 8cea3c0b0ed2b7f8cfe9ec1206a8bd07089eedc9 Mon Sep 17 00:00:00 2001 From: Dannon Baker Date: Wed, 25 Feb 2015 09:14:59 -0500 Subject: [PATCH 1/2] Fix returning encoded None library folder parent ids in library_contents API; thanks to nsoranzo --- lib/galaxy/webapps/galaxy/api/library_contents.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/galaxy/webapps/galaxy/api/library_contents.py b/lib/galaxy/webapps/galaxy/api/library_contents.py index 909935a58fd..d49a72010e8 100644 --- a/lib/galaxy/webapps/galaxy/api/library_contents.py +++ b/lib/galaxy/webapps/galaxy/api/library_contents.py @@ -128,7 +128,8 @@ class LibraryContentsController( BaseAPIController, UsesLibraryMixin, UsesLibrar content = self.get_library_folder( trans, content_id, check_ownership=False, check_accessible=True ) rval = content.to_dict( view='element', value_mapper={ 'id': trans.security.encode_id } ) rval[ 'id' ] = 'F' + str( rval[ 'id' ] ) - rval[ 'parent_id' ] = 'F' + str( trans.security.encode_id( rval[ 'parent_id' ] ) ) + if rval[ 'parent_id' ] is not None: # This can happen for root folders. + rval[ 'parent_id' ] = 'F' + str( trans.security.encode_id( rval[ 'parent_id' ] ) ) rval[ 'parent_library_id' ] = trans.security.encode_id( rval[ 'parent_library_id' ] ) else: content = self.get_library_dataset( trans, content_id, check_ownership=False, check_accessible=True ) From 721c6ad71cb02eb75b49640571505605a0704165 Mon Sep 17 00:00:00 2001 From: Dannon Baker Date: Thu, 26 Feb 2015 12:40:26 -0500 Subject: [PATCH 2/2] Fix cache-busting under require.js. --- lib/galaxy/webapps/galaxy/buildapp.py | 7 +++++-- templates/base.mako | 3 ++- templates/base/base_panels.mako | 3 ++- templates/webapps/galaxy/dataset/display.mako | 3 ++- templates/webapps/galaxy/dataset/tabular_chunked.mako | 3 ++- templates/webapps/galaxy/galaxy.panels.mako | 3 ++- templates/webapps/galaxy/history/display.mako | 3 ++- templates/webapps/galaxy/history/embed.mako | 3 ++- templates/webapps/galaxy/history/view.mako | 3 ++- templates/webapps/galaxy/root/tool_menu.mako | 3 ++- templates/webapps/galaxy/visualization/display.mako | 3 ++- templates/webapps/galaxy/visualization/phyloviz.mako | 3 ++- templates/webapps/galaxy/visualization/sweepster.mako | 3 ++- 13 files changed, 29 insertions(+), 14 deletions(-) diff --git a/lib/galaxy/webapps/galaxy/buildapp.py b/lib/galaxy/webapps/galaxy/buildapp.py index 9c3de5c5adf..8a4baa1af69 100644 --- a/lib/galaxy/webapps/galaxy/buildapp.py +++ b/lib/galaxy/webapps/galaxy/buildapp.py @@ -2,10 +2,11 @@ Provides factory methods to assemble the Galaxy web application """ -import sys +import atexit +import time import os import os.path -import atexit +import sys from paste import httpexceptions import pkg_resources @@ -114,6 +115,8 @@ def app_factory( global_conf, **kwargs ): except: pass + app.server_starttime = int(time.time()) # used for cachebusting + if not app.config.is_uwsgi: postfork_setup() diff --git a/templates/base.mako b/templates/base.mako index acef7faaec1..60b43a0fef0 100644 --- a/templates/base.mako +++ b/templates/base.mako @@ -79,7 +79,8 @@ shim: { "libs/underscore": { exports: "_" }, "libs/backbone/backbone": { exports: "Backbone" } - } + }, + urlArgs: 'v=${int(app.server_starttime)}' }); diff --git a/templates/base/base_panels.mako b/templates/base/base_panels.mako index 0da5a164fd6..9480968c028 100644 --- a/templates/base/base_panels.mako +++ b/templates/base/base_panels.mako @@ -89,7 +89,8 @@ shim: { "libs/underscore": { exports: "_" }, "libs/backbone/backbone": { exports: "Backbone" } - } + }, + urlArgs: 'v=${int(app.server_starttime)}' }); diff --git a/templates/webapps/galaxy/dataset/display.mako b/templates/webapps/galaxy/dataset/display.mako index 1d970f789b5..f1d062769b0 100644 --- a/templates/webapps/galaxy/dataset/display.mako +++ b/templates/webapps/galaxy/dataset/display.mako @@ -13,7 +13,8 @@ baseUrl: "${h.url_for('/static/scripts')}", shim: { "libs/backbone/backbone": { exports: "Backbone" }, - } + }, + urlArgs: 'v=${int(app.server_starttime)}' }); require(['mvc/data'], function(data) { diff --git a/templates/webapps/galaxy/dataset/tabular_chunked.mako b/templates/webapps/galaxy/dataset/tabular_chunked.mako index e48126ba051..66d35c00a2a 100644 --- a/templates/webapps/galaxy/dataset/tabular_chunked.mako +++ b/templates/webapps/galaxy/dataset/tabular_chunked.mako @@ -12,7 +12,8 @@ baseUrl: "${h.url_for('/static/scripts')}", shim: { "libs/backbone/backbone": { exports: "Backbone" }, - } + }, + urlArgs: 'v=${int(app.server_starttime)}' }); require([ 'mvc/data' ], function( data ) { diff --git a/templates/webapps/galaxy/galaxy.panels.mako b/templates/webapps/galaxy/galaxy.panels.mako index cfbedf8bc92..a39b2c059fe 100644 --- a/templates/webapps/galaxy/galaxy.panels.mako +++ b/templates/webapps/galaxy/galaxy.panels.mako @@ -97,7 +97,8 @@ "libs/underscore": { exports: "_" }, "libs/d3": { exports: "d3" }, "libs/backbone/backbone": { exports: "Backbone" }, - } + }, + urlArgs: 'v=${int(app.server_starttime)}' }); var galaxy_config = ${ h.dumps( self.galaxy_config ) }; diff --git a/templates/webapps/galaxy/history/display.mako b/templates/webapps/galaxy/history/display.mako index ee64338e038..99c6948b208 100644 --- a/templates/webapps/galaxy/history/display.mako +++ b/templates/webapps/galaxy/history/display.mako @@ -49,7 +49,8 @@ hdaJSON = ${h.dumps( hda_dicts )}; require.config({ - baseUrl : "${h.url_for( '/static/scripts' )}" + baseUrl : "${h.url_for( '/static/scripts' )}", + urlArgs: 'v=${int(app.server_starttime)}' })([ 'mvc/history/history-panel-annotated' ], function( panelMod ){ // history module is already in the dpn chain from the panel. We can re-scope it here. var historyModel = require( 'mvc/history/history-model' ), diff --git a/templates/webapps/galaxy/history/embed.mako b/templates/webapps/galaxy/history/embed.mako index e11f803a66b..ca799aae7c2 100644 --- a/templates/webapps/galaxy/history/embed.mako +++ b/templates/webapps/galaxy/history/embed.mako @@ -48,7 +48,8 @@ $embeddedHistory = $( thisScript ).prev(); require.config({ - baseUrl : "${h.url_for( '/static/scripts' )}" + baseUrl : "${h.url_for( '/static/scripts' )}", + urlArgs: 'v=${int(app.server_starttime)}' }); require([ 'mvc/history/history-panel-annotated' ], function( panelMod ){ diff --git a/templates/webapps/galaxy/history/view.mako b/templates/webapps/galaxy/history/view.mako index 8eae02ed8c5..c433ed9bef6 100644 --- a/templates/webapps/galaxy/history/view.mako +++ b/templates/webapps/galaxy/history/view.mako @@ -177,7 +177,8 @@ a.btn { baseUrl : "${h.url_for( '/static/scripts' )}", paths : { 'jquery' : 'libs/jquery/jquery' - } + }, + urlArgs: 'v=${int(app.server_starttime)}' })([ 'mvc/user/user-model', panelToUse.location, diff --git a/templates/webapps/galaxy/root/tool_menu.mako b/templates/webapps/galaxy/root/tool_menu.mako index 0d53df56a41..546ee36fd67 100644 --- a/templates/webapps/galaxy/root/tool_menu.mako +++ b/templates/webapps/galaxy/root/tool_menu.mako @@ -9,7 +9,8 @@ baseUrl: "${h.url_for('/static/scripts')}", shim: { "libs/underscore": { exports: "_" } - } + }, + urlArgs: 'v=${int(app.server_starttime)}' }); require(["mvc/tools"], function(tools_mod) { diff --git a/templates/webapps/galaxy/visualization/display.mako b/templates/webapps/galaxy/visualization/display.mako index 5085fd7e6eb..e0c0795f7d7 100644 --- a/templates/webapps/galaxy/visualization/display.mako +++ b/templates/webapps/galaxy/visualization/display.mako @@ -58,7 +58,8 @@ shim: { "libs/underscore": { exports: "_" }, "libs/backbone/backbone": { exports: "Backbone" }, - } + }, + urlArgs: 'v=${int(app.server_starttime)}' }); require( ["viz/trackster"], function(trackster) { diff --git a/templates/webapps/galaxy/visualization/phyloviz.mako b/templates/webapps/galaxy/visualization/phyloviz.mako index 437c9f8e10b..82bf6e4b282 100644 --- a/templates/webapps/galaxy/visualization/phyloviz.mako +++ b/templates/webapps/galaxy/visualization/phyloviz.mako @@ -147,7 +147,8 @@ shim: { "libs/underscore": { exports: "_" }, "libs/d3": { exports: "d3" } - } + }, + urlArgs: 'v=${int(app.server_starttime)}' }); require(["viz/phyloviz"], function(phyloviz_mod) { diff --git a/templates/webapps/galaxy/visualization/sweepster.mako b/templates/webapps/galaxy/visualization/sweepster.mako index f0565839bee..44749b488bd 100644 --- a/templates/webapps/galaxy/visualization/sweepster.mako +++ b/templates/webapps/galaxy/visualization/sweepster.mako @@ -116,7 +116,8 @@ "libs/underscore": { exports: "_" }, "libs/d3": { exports: "d3" }, "libs/backbone/backbone": { exports: "Backbone" }, - } + }, + urlArgs: 'v=${int(app.server_starttime)}' }); require(["libs/d3", "viz/sweepster"], function(d3, sweepster) {