# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User Greg Von Kuster <greg(a)bx.psu.edu>
# Date 1275930847 14400
# Node ID 1ab9d6b0ddfc65bc6e58c77891c57ef99e1e12cb
# Parent f415eee0950c78ccf103bde9d4adc8a853e55a1e
Yet another fix fo creating the history link on the library dataset information page - since it is possible to have an hda that does not have an associated history, we need to handle it.
--- a/templates/library/common/ldda_info.mako
+++ b/templates/library/common/ldda_info.mako
@@ -149,20 +149,17 @@
%for hda in associated_hdas:
<tr><td>
- <%
- hda_hist = trans.sa_session.query( trans.model.History ).get( hda.history_id )
- %>
- %if hda_hist:
- <a target="_blank" href="${h.url_for( controller='history', action='view', id=trans.security.encode_id( hda_hist.id ) )}">${hda_hist.get_display_name()}</a>
+ %if hda.history:
+ <a target="_blank" href="${h.url_for( controller='history', action='view', id=trans.security.encode_id( hda.history_id ) )}">${hda.history.get_display_name()}</a>
%else:
- error getting history
+ no history
%endif
</td><td>${hda.get_display_name()}</td><td>${time_ago( hda.update_time )}</td><td>
- %if hda_hist and hda_hist.user:
- ${hda_hist.user.email}
+ %if hda.history and hda.history.user:
+ ${hda.history.user.email}
%else:
anonymous
%endif
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User Nate Coraor <nate(a)bx.psu.edu>
# Date 1275924249 14400
# Node ID 4fb747f317d0b2c36ffb5fbf4b815caf4cb6ace1
# Parent 48ec25db21c3bd76b52bcd68a1301f777eea280e
When using gzip compression in the upstream proxy, do not gzip compress library tar.gz or zip archives. bz2 then remains as the only compression perfomed in Galaxy itself.
--- a/templates/library/common/common.mako
+++ b/templates/library/common/common.mako
@@ -382,15 +382,15 @@
# This condition should not contain an else clause because the user is not authorized
# to manage dataset permissions unless the default action is 'manage_permissions'
%endif
- %if 'bz2' in comptypes:
- <option value="tbz"
+ %if 'gz' in comptypes:
+ <option value="tgz"
%if default_action == 'download':
selected
%endif>
- >Download as a .tar.bz2 file</option>
+ >Download as a .tar.gz file</option>
%endif
- %if 'gz' in comptypes:
- <option value="tgz">Download as a .tar.gz file</option>
+ %if 'bz2' in comptypes:
+ <option value="tbz">Download as a .tar.bz2 file</option>
%endif
%if 'zip' in comptypes:
<option value="zip">Download as a .zip file</option>
--- a/lib/galaxy/web/controllers/library_common.py
+++ b/lib/galaxy/web/controllers/library_common.py
@@ -1364,14 +1364,22 @@ class LibraryCommon( BaseController ):
# Can't use mkstemp - the file must not exist first
tmpd = tempfile.mkdtemp()
tmpf = os.path.join( tmpd, 'library_download.' + action )
- if ziptype == '64':
+ if ziptype == '64' and trans.app.config.upstream_gzip:
+ archive = zipfile.ZipFile( tmpf, 'w', zipfile.ZIP_STORED, True )
+ elif ziptype == '64':
archive = zipfile.ZipFile( tmpf, 'w', zipfile.ZIP_DEFLATED, True )
+ elif trans.app.config.upstream_gzip:
+ archive = zipfile.ZipFile( tmpf, 'w', zipfile.ZIP_STORED )
else:
archive = zipfile.ZipFile( tmpf, 'w', zipfile.ZIP_DEFLATED )
archive.add = lambda x, y: archive.write( x, y.encode('CP437') )
elif action == 'tgz':
- archive = util.streamball.StreamBall( 'w|gz' )
- outext = 'tgz'
+ if trans.app.config.upstream_gzip:
+ archive = util.streamball.StreamBall( 'w' )
+ outext = 'tar'
+ else:
+ archive = util.streamball.StreamBall( 'w|gz' )
+ outext = 'tgz'
elif action == 'tbz':
archive = util.streamball.StreamBall( 'w|bz2' )
outext = 'tbz2'
--- a/lib/galaxy/config.py
+++ b/lib/galaxy/config.py
@@ -99,6 +99,7 @@ class Configuration( object ):
raise ConfigurationError( "user_library_import_dir specified in config (%s) does not exist" % self.user_library_import_dir )
self.allow_library_path_paste = kwargs.get( 'allow_library_path_paste', False )
# Configuration options for taking advantage of nginx features
+ self.upstream_gzip = string_as_bool( kwargs.get( 'upstream_gzip', False ) )
self.apache_xsendfile = kwargs.get( 'apache_xsendfile', False )
self.nginx_x_accel_redirect_base = kwargs.get( 'nginx_x_accel_redirect_base', False )
self.nginx_x_archive_files_base = kwargs.get( 'nginx_x_archive_files_base', False )
--- a/templates/library/common/browse_library.mako
+++ b/templates/library/common/browse_library.mako
@@ -507,12 +507,16 @@
TIP: Multiple compression options are available for downloading library datasets:
</p><ul style="padding-left: 1em; list-style-type: disc;">
+ %if 'gz' in comptypes:
+ <li>gzip: Compression is fastest and yields a larger file, making it more suitable for fast network connections.
+ %if trans.app.config.upstream_gzip:
+ NOTE: The file you receive will be an uncompressed .tar file - this is because the Galaxy server compresses it and your browser decompresses it on the fly.
+ %endif
+ </li>
+ %endif
%if 'bz2' in comptypes:
<li>bzip2: Compression takes the most time but is better for slower network connections (that transfer slower than the rate of compression) since the resulting file size is smallest.</li>
%endif
- %if 'gz' in comptypes:
- <li>gzip: Compression is faster and yields a larger file, making it more suitable for fast network connections.</li>
- %endif
%if 'zip' in comptypes:
<li>ZIP: Not recommended but is provided as an option for those on Windows without WinZip (since WinZip can read .bz2 and .gz files).</li>
%endif