galaxy-commits
Threads by month
- ----- 2026 -----
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
June 2011
- 1 participants
- 136 discussions
commit/galaxy-central: greg: Add a new select list to the upload form in the Galaxy tool shed with the following label:
by Bitbucket 21 Jun '11
by Bitbucket 21 Jun '11
21 Jun '11
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/d4e90b847749/
changeset: d4e90b847749
user: greg
date: 2011-06-21 22:22:14
summary: Add a new select list to the upload form in the Galaxy tool shed with the following label:
Remove files in the repository (relative to the upload point) that are not in the uploaded archive?
The selection pertains only to uploaded tar archives, not to single file uploads. If Yes is selected, files that exist in the repository (relative to the selected upload point) but that are not in the uploaded archive will be removed from the repository. Otherwise, all existing repository files will remain and the uploaded archive will be added to the repository. Fixes issue # 585.
affected #: 4 files (4.4 KB)
--- a/lib/galaxy/webapps/community/controllers/upload.py Tue Jun 21 10:14:24 2011 -0400
+++ b/lib/galaxy/webapps/community/controllers/upload.py Tue Jun 21 16:22:14 2011 -0400
@@ -2,7 +2,7 @@
from galaxy.web.base.controller import *
from galaxy.model.orm import *
from galaxy.datatypes.checkers import *
-from common import get_categories, get_repository, hg_add, hg_clone, hg_commit, hg_push, update_for_browsing
+from common import get_categories, get_repository, hg_add, hg_clone, hg_commit, hg_push, hg_remove, update_for_browsing
from mercurial import hg, ui
log = logging.getLogger( __name__ )
@@ -29,6 +29,7 @@
repo_dir = repository.repo_path
repo = hg.repository( ui.ui(), repo_dir )
uncompress_file = util.string_as_bool( params.get( 'uncompress_file', 'true' ) )
+ remove_repo_files_not_in_tar = util.string_as_bool( params.get( 'remove_repo_files_not_in_tar', 'true' ) )
uploaded_file = None
upload_point = params.get( 'upload_point', None )
if upload_point is not None:
@@ -144,8 +145,21 @@
# Clone the repository to a temporary location.
tmp_dir, cloned_repo_dir = hg_clone( trans, repository, current_working_dir )
# Move the uploaded files to the upload_point within the cloned repository.
- self.__move_to_upload_point( upload_point, uploaded_file, uploaded_file_name, uploaded_file_filename, cloned_repo_dir, istar, tar )
- # Add the files to the cloned repository.
+ files_to_remove = self.__move_to_upload_point( repository,
+ upload_point,
+ uploaded_file,
+ uploaded_file_name,
+ uploaded_file_filename,
+ cloned_repo_dir,
+ istar,
+ tar,
+ remove_repo_files_not_in_tar )
+ if remove_repo_files_not_in_tar and files_to_remove:
+ # Remove files in the repository (relative to the upload point)
+ # that are not in the uploaded archive.
+ for repo_file in files_to_remove:
+ hg_remove( repo_file, current_working_dir, cloned_repo_dir )
+ # Add the files in the uploaded archive to the cloned repository.
hg_add( trans, current_working_dir, cloned_repo_dir )
# Commit the files to the cloned repository.
if not commit_message:
@@ -165,6 +179,8 @@
else:
uncompress_str = ' '
message = "The file '%s' has been successfully%suploaded to the repository." % ( uploaded_file_filename, uncompress_str )
+ if istar and remove_repo_files_not_in_tar:
+ message += " %d files were removed from the repository." % len( files_to_remove )
else:
message = 'No changes to repository.'
trans.response.send_redirect( web.url_for( controller='repository',
@@ -199,6 +215,7 @@
repository=repository,
commit_message=commit_message,
uncompress_file=uncompress_file,
+ remove_repo_files_not_in_tar=remove_repo_files_not_in_tar,
message=message,
status=status )
def uncompress( self, repository, uploaded_file_name, uploaded_file_filename, isgzip, isbz2 ):
@@ -242,7 +259,9 @@
os.close( fd )
bzipped_file.close()
shutil.move( uncompressed, uploaded_file_name )
- def __move_to_upload_point( self, upload_point, uploaded_file, uploaded_file_name, uploaded_file_filename, cloned_repo_dir, istar, tar ):
+ def __move_to_upload_point( self, repository, upload_point, uploaded_file, uploaded_file_name,
+ uploaded_file_filename, cloned_repo_dir, istar, tar, remove_repo_files_not_in_tar ):
+ files_to_remove = []
if upload_point is not None:
if istar:
full_path = os.path.abspath( os.path.join( cloned_repo_dir, upload_point ) )
@@ -254,6 +273,22 @@
else:
full_path = os.path.abspath( os.path.join( cloned_repo_dir, uploaded_file_filename ) )
if istar:
+ if remove_repo_files_not_in_tar:
+ # Discover those files that are in the repository, but not in the uploaded archive
+ filenames_in_archive = [ tarinfo_obj.name for tarinfo_obj in tar.getmembers() ]
+ for root, dirs, files in os.walk( full_path ):
+ relative_dir = root.split( 'repo_%d' % repository.id )[1].lstrip( '/' )
+ if not root.find( '.hg' ) >= 0 and not root.find( 'hgrc' ) >= 0:
+ if '.hg' in dirs:
+ # Don't visit .hg directories
+ dirs.remove( '.hg' )
+ if 'hgrc' in files:
+ # Don't include hgrc files in commit - should be impossible
+ # since we don't visit .hg dirs, but just in case...
+ files.remove( 'hgrc' )
+ for name in files:
+ if name not in filenames_in_archive:
+ files_to_remove.append( os.path.join( relative_dir, name ) )
# Extract the uploaded tarball to the load_point within the cloned repository hierarchy
tar.extractall( path=full_path )
tar.close()
@@ -261,6 +296,7 @@
else:
# Move the uploaded file to the load_point within the cloned repository hierarchy
shutil.move( uploaded_file_name, full_path )
+ return files_to_remove
def __check_archive( self, archive ):
for member in archive.getmembers():
# Allow regular files and directories only
--- a/templates/webapps/community/repository/manage_repository.mako Tue Jun 21 10:14:24 2011 -0400
+++ b/templates/webapps/community/repository/manage_repository.mako Tue Jun 21 16:22:14 2011 -0400
@@ -111,7 +111,11 @@
</div><div class="form-row"><label>Version:</label>
- ${tip}
+ %if can_view_change_log:
+ <a href="${h.url_for( controller='repository', action='view_changelog', id=trans.app.security.encode_id( repository.id ) )}">${tip}</a>
+ %else:
+ ${tip}
+ %endif
</div><div class="form-row"><label>Owner:</label>
--- a/templates/webapps/community/repository/upload.mako Tue Jun 21 10:14:24 2011 -0400
+++ b/templates/webapps/community/repository/upload.mako Tue Jun 21 16:22:14 2011 -0400
@@ -97,7 +97,30 @@
</div></div><div class="form-row">
- <label>Message:</label>
+ <%
+ if remove_repo_files_not_in_tar:
+ yes_selected = 'selected'
+ no_selected = ''
+ else:
+ yes_selected = ''
+ no_selected = 'selected'
+ %>
+ <label>Remove files in the repository (relative to the upload point) that are not in the uploaded archive?</label>
+ <div class="form-row-input">
+ <select name="remove_repo_files_not_in_tar">
+ <option value="true" ${yes_selected}>Yes
+ <option value="false" ${no_selected}>No
+ </select>
+ </div>
+ <div class="toolParamHelp" style="clear: both;">
+ This selection pertains only to uploaded tar archives, not to single file uploads. If <b>Yes</b> is selected, files
+ that exist in the repository (relative to the upload point) but that are not in the uploaded archive will be removed
+ from the repository. Otherwise, all existing repository files will remain and the uploaded archive files will be added
+ to the repository.
+ </div>
+ </div>
+ <div class="form-row">
+ <label>Change set commit message:</label><div class="form-row-input">
%if commit_message:
<textarea name="commit_message" rows="3" cols="35">${commit_message}</textarea>
@@ -118,7 +141,8 @@
</div><input type="hidden" id="upload_point" name="upload_point" value=""/><div class="toolParamHelp" style="clear: both;">
- Select a location within the repository to upload your files by clicking a check box next to the location. If a location is not selected, files will be uploaded to the repository root.
+ Select a location within the repository to upload your files by clicking a check box next to the location. If a location
+ is not selected, files will be uploaded to the repository root.
</div><div style="clear: both"></div></div>
--- a/templates/webapps/community/repository/view_repository.mako Tue Jun 21 10:14:24 2011 -0400
+++ b/templates/webapps/community/repository/view_repository.mako Tue Jun 21 16:22:14 2011 -0400
@@ -100,7 +100,11 @@
</div><div class="form-row"><label>Name:</label>
- ${repository.name}
+ %if can_browse_contents:
+ <a href="${h.url_for( controller='repository', action='browse_repository', id=trans.app.security.encode_id( repository.id ) )}">${repository.name}</a>
+ %else:
+ ${repository.name}
+ %endif
</div><div class="form-row"><label>Description:</label>
@@ -108,7 +112,11 @@
</div><div class="form-row"><label>Version:</label>
- ${tip}
+ %if can_view_change_log:
+ <a href="${h.url_for( controller='repository', action='view_changelog', id=trans.app.security.encode_id( repository.id ) )}">${tip}</a>
+ %else:
+ ${tip}
+ %endif
</div><div class="form-row"><label>Owner:</label>
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: greg: Add security checks for enabling the ability to delete files in a tool shed repository.
by Bitbucket 21 Jun '11
by Bitbucket 21 Jun '11
21 Jun '11
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/e23f05a3fb41/
changeset: e23f05a3fb41
user: greg
date: 2011-06-21 16:14:24
summary: Add security checks for enabling the ability to delete files in a tool shed repository.
affected #: 6 files (1.2 KB)
--- a/templates/webapps/community/repository/browse_repository.mako Tue Jun 21 09:38:06 2011 -0400
+++ b/templates/webapps/community/repository/browse_repository.mako Tue Jun 21 10:14:24 2011 -0400
@@ -93,38 +93,52 @@
%if can_browse_contents:
<div class="toolForm"><div class="toolFormTitle">Browse ${repository.name}</div>
- <form name="select_files_to_delete" id="select_files_to_delete" action="${h.url_for( controller='repository', action='select_files_to_delete', id=trans.security.encode_id( repository.id ))}" method="post" >
- <div class="form-row" >
- <label>Contents:</label>
- <div id="tree" >
- Loading...
+ %if can_push:
+ <form name="select_files_to_delete" id="select_files_to_delete" action="${h.url_for( controller='repository', action='select_files_to_delete', id=trans.security.encode_id( repository.id ))}" method="post" >
+ <div class="form-row" >
+ <label>Contents:</label>
+ <div id="tree" >
+ Loading...
+ </div>
+ <div class="toolParamHelp" style="clear: both;">
+ Click on a file to display it's contents below. You may delete files from the repository by clicking the check box next to each file and clicking the <b>Delete selected files</b> button.
+ </div>
+ <input id="selected_files_to_delete" name="selected_files_to_delete" type="hidden" value=""/></div>
- <div class="toolParamHelp" style="clear: both;">
- Click on a file to display it's contents below. You may delete files from the repository by clicking the check box next to each file and clicking the <b>Delete selected files</b> button.
+ <div class="form-row">
+ <label>Message:</label>
+ <div class="form-row-input">
+ %if commit_message:
+ <textarea name="commit_message" rows="3" cols="35">${commit_message}</textarea>
+ %else:
+ <textarea name="commit_message" rows="3" cols="35"></textarea>
+ %endif
+ </div>
+ <div class="toolParamHelp" style="clear: both;">
+ This is the commit message for the mercurial change set that will be created if you delete selected files.
+ </div>
+ <div style="clear: both"></div></div>
- <input id="selected_files_to_delete" name="selected_files_to_delete" type="hidden" value=""/>
+ <div class="form-row">
+ <input type="submit" name="select_files_to_delete_button" value="Delete selected files"/>
+ </div>
+ <div class="form-row">
+ <div id="file_contents" class="toolParamHelp" style="clear: both;background-color:#FAFAFA;"></div>
+ </div>
+ </form>
+ %else:
+ <div class="toolFormBody">
+ <div class="form-row" >
+ <label>Contents:</label>
+ <div id="tree" >
+ Loading...
+ </div>
+ </div>
+ <div class="form-row">
+ <div id="file_contents" class="toolParamHelp" style="clear: both;background-color:#FAFAFA;"></div>
+ </div></div>
- <div class="form-row">
- <label>Message:</label>
- <div class="form-row-input">
- %if commit_message:
- <textarea name="commit_message" rows="3" cols="35">${commit_message}</textarea>
- %else:
- <textarea name="commit_message" rows="3" cols="35"></textarea>
- %endif
- </div>
- <div class="toolParamHelp" style="clear: both;">
- This is the commit message for the mercurial change set that will be created if you delete selected files.
- </div>
- <div style="clear: both"></div>
- </div>
- <div class="form-row">
- <input type="submit" name="select_files_to_delete_button" value="Delete selected files"/>
- </div>
- <div class="form-row">
- <div id="file_contents" class="toolParamHelp" style="clear: both;background-color:#FAFAFA;"></div>
- </div>
- </form>
+ %endif
</div><p/>
%endif
--- a/templates/webapps/community/repository/manage_repository.mako Tue Jun 21 09:38:06 2011 -0400
+++ b/templates/webapps/community/repository/manage_repository.mako Tue Jun 21 10:14:24 2011 -0400
@@ -11,6 +11,10 @@
can_browse_contents = not is_new
can_rate = not is_new and repository.user != trans.user
can_view_change_log = not is_new
+ if can_push:
+ browse_label = 'Browse or delete repository files'
+ else:
+ browse_label = 'Browse repository files'
%><%!
@@ -74,7 +78,7 @@
<a class="action-button" href="${h.url_for( controller='repository', action='rate_repository', id=trans.app.security.encode_id( repository.id ) )}">Rate repository</a>
%endif
%if can_browse_contents:
- <a class="action-button" href="${h.url_for( controller='repository', action='browse_repository', id=trans.app.security.encode_id( repository.id ) )}">Browse or delete repository files</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='browse_repository', id=trans.app.security.encode_id( repository.id ) )}">${browse_label}</a>
%endif
<a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), file_type='gz' )}">Download as a .tar.gz file</a><a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), file_type='bz2' )}">Download as a .tar.bz2 file</a>
--- a/templates/webapps/community/repository/rate_repository.mako Tue Jun 21 09:38:06 2011 -0400
+++ b/templates/webapps/community/repository/rate_repository.mako Tue Jun 21 10:14:24 2011 -0400
@@ -11,6 +11,10 @@
can_rate = repository.user != trans.user
can_manage = repository.user == trans.user
can_view_change_log = not is_new
+ if can_push:
+ browse_label = 'Browse or delete repository files'
+ else:
+ browse_label = 'Browse repository files'
%><%!
@@ -79,7 +83,7 @@
<a class="action-button" href="${h.url_for( controller='repository', action='view_changelog', id=trans.app.security.encode_id( repository.id ) )}">View change log</a>
%endif
%if can_browse_contents:
- <a class="action-button" href="${h.url_for( controller='repository', action='browse_repository', id=trans.app.security.encode_id( repository.id ) )}">Browse or delete repository files</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='browse_repository', id=trans.app.security.encode_id( repository.id ) )}">${browse_label}</a>
%endif
<a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), file_type='gz' )}">Download as a .tar.gz file</a><a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), file_type='bz2' )}">Download as a .tar.bz2 file</a>
--- a/templates/webapps/community/repository/view_changelog.mako Tue Jun 21 09:38:06 2011 -0400
+++ b/templates/webapps/community/repository/view_changelog.mako Tue Jun 21 10:14:24 2011 -0400
@@ -11,6 +11,10 @@
can_push = trans.app.security_agent.can_push( trans.user, repository )
can_rate = repository.user != trans.user
can_upload = can_push
+ if can_push:
+ browse_label = 'Browse or delete repository files'
+ else:
+ browse_label = 'Browse repository files'
%><%!
@@ -48,7 +52,7 @@
<a class="action-button" href="${h.url_for( controller='repository', action='rate_repository', id=trans.app.security.encode_id( repository.id ) )}">Rate repository</a>
%endif
%if can_browse_contents:
- <a class="action-button" href="${h.url_for( controller='repository', action='browse_repository', id=trans.app.security.encode_id( repository.id ) )}">Browse or delete repository files</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='browse_repository', id=trans.app.security.encode_id( repository.id ) )}">${browse_label}</a>
%endif
<a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), file_type='gz' )}">Download as a .tar.gz file</a><a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), file_type='bz2' )}">Download as a .tar.bz2 file</a>
--- a/templates/webapps/community/repository/view_changeset.mako Tue Jun 21 09:38:06 2011 -0400
+++ b/templates/webapps/community/repository/view_changeset.mako Tue Jun 21 10:14:24 2011 -0400
@@ -12,6 +12,10 @@
can_push = trans.app.security_agent.can_push( trans.user, repository )
can_view_change_log = not is_new
can_upload = can_push
+ if can_push:
+ browse_label = 'Browse or delete repository files'
+ else:
+ browse_label = 'Browse repository files'
%><%!
@@ -52,7 +56,7 @@
<a class="action-button" href="${h.url_for( controller='repository', action='rate_repository', id=trans.app.security.encode_id( repository.id ) )}">Rate repository</a>
%endif
%if can_browse_contents:
- <a class="action-button" href="${h.url_for( controller='repository', action='browse_repository', id=trans.app.security.encode_id( repository.id ) )}">Browse or delete repository files</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='browse_repository', id=trans.app.security.encode_id( repository.id ) )}">${browse_label}</a>
%endif
<a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), file_type='gz' )}">Download as a .tar.gz file</a><a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), file_type='bz2' )}">Download as a .tar.bz2 file</a>
--- a/templates/webapps/community/repository/view_repository.mako Tue Jun 21 09:38:06 2011 -0400
+++ b/templates/webapps/community/repository/view_repository.mako Tue Jun 21 10:14:24 2011 -0400
@@ -11,6 +11,10 @@
can_upload = can_push
can_browse_contents = not is_new
can_view_change_log = not is_new
+ if can_push:
+ browse_label = 'Browse or delete repository files'
+ else:
+ browse_label = 'Browse repository files'
%><%!
@@ -74,7 +78,7 @@
<a class="action-button" href="${h.url_for( controller='repository', action='rate_repository', id=trans.app.security.encode_id( repository.id ) )}">Rate repository</a>
%endif
%if can_browse_contents:
- <a class="action-button" href="${h.url_for( controller='repository', action='browse_repository', id=trans.app.security.encode_id( repository.id ) )}">Browse or delete repository files</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='browse_repository', id=trans.app.security.encode_id( repository.id ) )}">${browse_label}</a>
%endif
<a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), file_type='gz' )}">Download as a .tar.gz file</a><a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), file_type='bz2' )}">Download as a .tar.bz2 file</a>
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
21 Jun '11
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/dbd80b36e0ba/
changeset: dbd80b36e0ba
user: greg
date: 2011-06-21 15:38:06
summary: Add the ability to select files for deletion from the repository using the built-in file browser. Any number of selected files will be deleted. Selecting a folder will delete all of it's contents. Fixes issue # 584.
affected #: 11 files (8.7 KB)
--- a/lib/galaxy/webapps/community/controllers/common.py Mon Jun 20 17:02:51 2011 -0400
+++ b/lib/galaxy/webapps/community/controllers/common.py Tue Jun 21 09:38:06 2011 -0400
@@ -1,10 +1,11 @@
-import tarfile
+import os, tarfile, tempfile, shutil
from galaxy.web.base.controller import *
from galaxy.webapps.community import model
from galaxy.model.orm import *
from galaxy.web.framework.helpers import time_ago, iff, grids
from galaxy.web.form_builder import SelectField
from galaxy.model.item_attrs import UsesItemRatings
+from mercurial import hg, ui
import logging
log = logging.getLogger( __name__ )
@@ -58,3 +59,55 @@
def get_user( trans, id ):
"""Get a user from the database"""
return trans.sa_session.query( trans.model.User ).get( trans.security.decode_id( id ) )
+def hg_add( trans, current_working_dir, cloned_repo_dir ):
+ # Add files to a cloned repository. If they're already tracked, this should do nothing.
+ os.chdir( cloned_repo_dir )
+ os.system( 'hg add > /dev/null 2>&1' )
+ os.chdir( current_working_dir )
+def hg_clone( trans, repository, current_working_dir ):
+ # Make a clone of a repository in a temporary location.
+ repo_dir = repository.repo_path
+ tmp_dir = tempfile.mkdtemp()
+ tmp_archive_dir = os.path.join( tmp_dir, 'tmp_archive_dir' )
+ if not os.path.exists( tmp_archive_dir ):
+ os.makedirs( tmp_archive_dir )
+ cmd = "hg clone %s > /dev/null 2>&1" % os.path.abspath( repo_dir )
+ os.chdir( tmp_archive_dir )
+ os.system( cmd )
+ os.chdir( current_working_dir )
+ cloned_repo_dir = os.path.join( tmp_archive_dir, 'repo_%d' % repository.id )
+ return tmp_dir, cloned_repo_dir
+def hg_commit( commit_message, current_working_dir, cloned_repo_dir ):
+ # Commit a change set to a cloned repository.
+ if not commit_message:
+ commit_message = "No commit message"
+ os.chdir( cloned_repo_dir )
+ os.system( "hg commit -m '%s' > /dev/null 2>&1" % commit_message )
+ os.chdir( current_working_dir )
+def hg_push( trans, repository, current_working_dir, cloned_repo_dir ):
+ # Push a change set from a cloned repository to a master repository.
+ repo_dir = repository.repo_path
+ repo = hg.repository( ui.ui(), repo_dir )
+ # We want these change sets to be associated with the owner of the repository, so we'll
+ # set the HGUSER environment variable accordingly.
+ os.environ[ 'HGUSER' ] = trans.user.username
+ cmd = "hg push %s > /dev/null 2>&1" % os.path.abspath( repo_dir )
+ os.chdir( cloned_repo_dir )
+ os.system( cmd )
+ os.chdir( current_working_dir )
+def hg_remove( file_path, current_working_dir, cloned_repo_dir ):
+ # Remove a file path from a cloned repository. Since mercurial doesn't track
+ # directories (only files), directories are automatically removed when they
+ # become empty.
+ abs_file_path = os.path.join( cloned_repo_dir, file_path )
+ if os.path.exists( abs_file_path ):
+ cmd = 'hg remove %s > /dev/null 2>&1' % file_path
+ os.chdir( cloned_repo_dir )
+ os.system( cmd )
+ os.chdir( current_working_dir )
+def update_for_browsing( repository, current_working_dir ):
+ # Make a copy of a repository's files for browsing.
+ repo_dir = repository.repo_path
+ os.chdir( repo_dir )
+ os.system( 'hg update > /dev/null 2>&1' )
+ os.chdir( current_working_dir )
--- a/lib/galaxy/webapps/community/controllers/repository.py Mon Jun 20 17:02:51 2011 -0400
+++ b/lib/galaxy/webapps/community/controllers/repository.py Tue Jun 21 09:38:06 2011 -0400
@@ -378,7 +378,13 @@
return config.get( "web", option )
raise Exception( "Repository %s missing allow_push entry under the [web] option in it's hgrc file." % repository.name )
def __set_allow_push( self, repository, usernames, remove_auth='' ):
- # TODO: Use the mercurial api to handle this
+ """
+ # TODO: Use the mercurial api to handle this, something like the following:
+ items = repo.ui.configitems( section, untrusted=False )
+ push_section = repo.ui.config( 'hgrc', 'allow_push' )
+ for XXX (in name you want to add):
+ repo.ui.updateconfig( section=extensions_section, name='XXX', value='YYY' )
+ """
hgrc_file = os.path.abspath( os.path.join( repository.repo_path, ".hg", "hgrc" ) )
fh, fn = tempfile.mkstemp()
for i, line in enumerate( open( hgrc_file ) ):
@@ -403,6 +409,7 @@
params = util.Params( kwd )
message = util.restore_text( params.get( 'message', '' ) )
status = params.get( 'status', 'done' )
+ commit_message = util.restore_text( params.get( 'commit_message', 'Deleted selected files' ) )
repository = get_repository( trans, id )
repo = hg.repository( ui.ui(), repository.repo_path )
# Our current support for browsing a repository requires copies of the
@@ -416,6 +423,56 @@
return trans.fill_template( '/webapps/community/repository/browse_repository.mako',
repo=repo,
repository=repository,
+ commit_message=commit_message,
+ message=message,
+ status=status )
+ @web.expose
+ def select_files_to_delete( self, trans, id, **kwd ):
+ params = util.Params( kwd )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
+ commit_message = util.restore_text( params.get( 'commit_message', 'Deleted selected files' ) )
+ repository = get_repository( trans, id )
+ _ui = ui.ui()
+ repo_dir = repository.repo_path
+ repo = hg.repository( _ui, repo_dir )
+ selected_files_to_delete = util.restore_text( params.get( 'selected_files_to_delete', '' ) )
+ if params.get( 'select_files_to_delete_button', False ):
+ if selected_files_to_delete:
+ selected_files_to_delete = selected_files_to_delete.split( ',' )
+ current_working_dir = os.getcwd()
+ # Get the current repository tip.
+ tip = repo[ 'tip' ]
+ # Clone the repository to a temporary location.
+ tmp_dir, cloned_repo_dir = hg_clone( trans, repository, current_working_dir )
+ # Delete the selected files from the repository.
+ cloned_repo = hg.repository( _ui, cloned_repo_dir )
+ for selected_file in selected_files_to_delete:
+ selected_file_path = selected_file.split( 'repo_%d' % repository.id )[ 1 ].lstrip( '/' )
+ hg_remove( selected_file_path, current_working_dir, cloned_repo_dir )
+ # Commit the change set.
+ if not commit_message:
+ commit_message = 'Deleted selected files'
+ hg_commit( commit_message, current_working_dir, cloned_repo_dir )
+ # Push the change set from the cloned repository to the master repository.
+ hg_push( trans, repository, current_working_dir, cloned_repo_dir )
+ # Remove the temporary directory containing the cloned repository.
+ shutil.rmtree( tmp_dir )
+ # Update the repository files for browsing.
+ update_for_browsing( repository, current_working_dir )
+ # Get the new repository tip.
+ repo = hg.repository( _ui, repo_dir )
+ if tip != repo[ 'tip' ]:
+ message = "The selected files were deleted from the repository."
+ else:
+ message = 'No changes to repository.'
+ else:
+ message = "Select at least 1 file to delete from the repository before clicking <b>Delete selected files</b>."
+ status = "error"
+ return trans.fill_template( '/webapps/community/repository/browse_repository.mako',
+ repo=repo,
+ repository=repository,
+ commit_message=commit_message,
message=message,
status=status )
@web.expose
--- a/lib/galaxy/webapps/community/controllers/upload.py Mon Jun 20 17:02:51 2011 -0400
+++ b/lib/galaxy/webapps/community/controllers/upload.py Tue Jun 21 09:38:06 2011 -0400
@@ -2,7 +2,7 @@
from galaxy.web.base.controller import *
from galaxy.model.orm import *
from galaxy.datatypes.checkers import *
-from common import get_categories, get_repository
+from common import get_categories, get_repository, hg_add, hg_clone, hg_commit, hg_push, update_for_browsing
from mercurial import hg, ui
log = logging.getLogger( __name__ )
@@ -139,12 +139,39 @@
# We have a repository that is not new (it contains files).
if uncompress_file and ( isgzip or isbz2 ):
uploaded_file_filename = self.uncompress( repository, uploaded_file_name, uploaded_file_filename, isgzip, isbz2 )
+ # Get the current repository tip.
+ tip = repo[ 'tip' ]
# Clone the repository to a temporary location.
- tmp_dir, cloned_repo_dir = self.__hg_clone( trans, repository, repo_dir, current_working_dir )
+ tmp_dir, cloned_repo_dir = hg_clone( trans, repository, current_working_dir )
# Move the uploaded files to the upload_point within the cloned repository.
self.__move_to_upload_point( upload_point, uploaded_file, uploaded_file_name, uploaded_file_filename, cloned_repo_dir, istar, tar )
- # Commit and push the changes from the cloned repo to the master repo.
- self.__hg_push( trans, repository, file_data.filename, uncompress_file, commit_message, current_working_dir, cloned_repo_dir, repo_dir, tmp_dir )
+ # Add the files to the cloned repository.
+ hg_add( trans, current_working_dir, cloned_repo_dir )
+ # Commit the files to the cloned repository.
+ if not commit_message:
+ commit_message = 'Uploaded'
+ hg_commit( commit_message, current_working_dir, cloned_repo_dir )
+ # Push the changes from the cloned repository to the master repository.
+ hg_push( trans, repository, current_working_dir, cloned_repo_dir )
+ # Remove the temporary directory containing the cloned repository.
+ shutil.rmtree( tmp_dir )
+ # Update the repository files for browsing.
+ update_for_browsing( repository, current_working_dir )
+ # Get the new repository tip.
+ repo = hg.repository( ui.ui(), repo_dir )
+ if tip != repo[ 'tip' ]:
+ if uncompress_file:
+ uncompress_str = ' uncompressed and '
+ else:
+ uncompress_str = ' '
+ message = "The file '%s' has been successfully%suploaded to the repository." % ( uploaded_file_filename, uncompress_str )
+ else:
+ message = 'No changes to repository.'
+ trans.response.send_redirect( web.url_for( controller='repository',
+ action='browse_repository',
+ commit_message='Deleted selected files',
+ message=message,
+ id=trans.security.encode_id( repository.id ) ) )
if ok:
if files_to_commit:
repo.dirstate.write()
@@ -159,6 +186,7 @@
message = "The file '%s' has been successfully%suploaded to the repository." % ( uploaded_file_filename, uncompress_str )
trans.response.send_redirect( web.url_for( controller='repository',
action='browse_repository',
+ commit_message='Deleted selected files',
message=message,
id=trans.security.encode_id( repository.id ) ) )
else:
@@ -214,55 +242,6 @@
os.close( fd )
bzipped_file.close()
shutil.move( uncompressed, uploaded_file_name )
- def __hg_clone( self, trans, repository, repo_dir, current_working_dir ):
- tmp_dir = tempfile.mkdtemp()
- tmp_archive_dir = os.path.join( tmp_dir, 'tmp_archive_dir' )
- if not os.path.exists( tmp_archive_dir ):
- os.makedirs( tmp_archive_dir )
- # Make a clone of the repository in a temporary location
- cmd = "hg clone %s > /dev/null 2>&1" % os.path.abspath( repo_dir )
- os.chdir( tmp_archive_dir )
- os.system( cmd )
- os.chdir( current_working_dir )
- cloned_repo_dir = os.path.join( tmp_archive_dir, 'repo_%d' % repository.id )
- return tmp_dir, cloned_repo_dir
- def __hg_push( self, trans, repository, filename, uncompress_file, commit_message, current_working_dir, cloned_repo_dir, repo_dir, tmp_dir ):
- repo = hg.repository( ui.ui(), repo_dir )
- tip = repo[ 'tip' ]
- # We want these change sets to be associated with the owner of the repository, so we'll
- # set the HGUSER environment variable accordingly.
- os.environ[ 'HGUSER' ] = trans.user.username
- # Add the file to the cloned repository. If it's already tracked, this should do nothing.
- os.chdir( cloned_repo_dir )
- os.system( 'hg add > /dev/null 2>&1' )
- os.chdir( current_working_dir )
- os.chdir( cloned_repo_dir )
- # Commit the change set to the cloned repository
- os.system( "hg commit -m '%s' > /dev/null 2>&1" % commit_message )
- os.chdir( current_working_dir )
- # Push the change set to the master repository
- cmd = "hg push %s > /dev/null 2>&1" % os.path.abspath( repo_dir )
- os.chdir( cloned_repo_dir )
- os.system( cmd )
- os.chdir( current_working_dir )
- # Make a copy of the updated repository files for browsing.
- os.chdir( repo_dir )
- os.system( 'hg update > /dev/null 2>&1' )
- os.chdir( current_working_dir )
- shutil.rmtree( tmp_dir )
- repo = hg.repository( ui.ui(), repo_dir )
- if tip != repo[ 'tip' ]:
- if uncompress_file:
- uncompress_str = ' uncompressed and '
- else:
- uncompress_str = ' '
- message = "The file '%s' has been successfully%suploaded to the repository." % ( filename, uncompress_str )
- else:
- message = 'No changes in uploaded files.'
- trans.response.send_redirect( web.url_for( controller='repository',
- action='browse_repository',
- message=message,
- id=trans.security.encode_id( repository.id ) ) )
def __move_to_upload_point( self, upload_point, uploaded_file, uploaded_file_name, uploaded_file_filename, cloned_repo_dir, istar, tar ):
if upload_point is not None:
if istar:
--- a/templates/webapps/community/repository/browse_repository.mako Mon Jun 20 17:02:51 2011 -0400
+++ b/templates/webapps/community/repository/browse_repository.mako Tue Jun 21 09:38:06 2011 -0400
@@ -93,17 +93,38 @@
%if can_browse_contents:
<div class="toolForm"><div class="toolFormTitle">Browse ${repository.name}</div>
- <div class="toolFormBody">
+ <form name="select_files_to_delete" id="select_files_to_delete" action="${h.url_for( controller='repository', action='select_files_to_delete', id=trans.security.encode_id( repository.id ))}" method="post" ><div class="form-row" ><label>Contents:</label><div id="tree" >
Loading...
</div>
+ <div class="toolParamHelp" style="clear: both;">
+ Click on a file to display it's contents below. You may delete files from the repository by clicking the check box next to each file and clicking the <b>Delete selected files</b> button.
+ </div>
+ <input id="selected_files_to_delete" name="selected_files_to_delete" type="hidden" value=""/>
+ </div>
+ <div class="form-row">
+ <label>Message:</label>
+ <div class="form-row-input">
+ %if commit_message:
+ <textarea name="commit_message" rows="3" cols="35">${commit_message}</textarea>
+ %else:
+ <textarea name="commit_message" rows="3" cols="35"></textarea>
+ %endif
+ </div>
+ <div class="toolParamHelp" style="clear: both;">
+ This is the commit message for the mercurial change set that will be created if you delete selected files.
+ </div>
+ <div style="clear: both"></div>
+ </div>
+ <div class="form-row">
+ <input type="submit" name="select_files_to_delete_button" value="Delete selected files"/></div><div class="form-row"><div id="file_contents" class="toolParamHelp" style="clear: both;background-color:#FAFAFA;"></div></div>
- </div>
+ </form></div><p/>
%endif
--- a/templates/webapps/community/repository/common.mako Mon Jun 20 17:02:51 2011 -0400
+++ b/templates/webapps/community/repository/common.mako Tue Jun 21 09:38:06 2011 -0400
@@ -35,11 +35,17 @@
// Display list of selected nodes
var selNodes = dtnode.tree.getSelectedNodes();
// convert to title/key array
- var selKeys = $.map(selNodes, function(node){
+ var selKeys = $.map(selNodes, function(node) {
return node.data.key;
});
- // The following is used only in the upload form.
- document.upload_form.upload_point.value = selKeys[0];
+ if (document.forms["select_files_to_delete"]) {
+ // The following is used only ~/templates/webapps/community/repository/browse_repository.mako.
+ document.select_files_to_delete.selected_files_to_delete.value = selKeys.join(",");
+ }
+ // The following is used only in ~/templates/webapps/community/repository/upload.mako.
+ if (document.forms["upload_form"]) {
+ document.upload_form.upload_point.value = selKeys[0];
+ }
},
onActivate: function(dtnode) {
var cell = $("#file_contents");
--- a/templates/webapps/community/repository/manage_repository.mako Mon Jun 20 17:02:51 2011 -0400
+++ b/templates/webapps/community/repository/manage_repository.mako Tue Jun 21 09:38:06 2011 -0400
@@ -74,7 +74,7 @@
<a class="action-button" href="${h.url_for( controller='repository', action='rate_repository', id=trans.app.security.encode_id( repository.id ) )}">Rate repository</a>
%endif
%if can_browse_contents:
- <a class="action-button" href="${h.url_for( controller='repository', action='browse_repository', id=trans.app.security.encode_id( repository.id ) )}">Browse repository</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='browse_repository', id=trans.app.security.encode_id( repository.id ) )}">Browse or delete repository files</a>
%endif
<a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), file_type='gz' )}">Download as a .tar.gz file</a><a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), file_type='bz2' )}">Download as a .tar.bz2 file</a>
--- a/templates/webapps/community/repository/rate_repository.mako Mon Jun 20 17:02:51 2011 -0400
+++ b/templates/webapps/community/repository/rate_repository.mako Tue Jun 21 09:38:06 2011 -0400
@@ -79,7 +79,7 @@
<a class="action-button" href="${h.url_for( controller='repository', action='view_changelog', id=trans.app.security.encode_id( repository.id ) )}">View change log</a>
%endif
%if can_browse_contents:
- <a class="action-button" href="${h.url_for( controller='repository', action='browse_repository', id=trans.app.security.encode_id( repository.id ) )}">Browse repository</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='browse_repository', id=trans.app.security.encode_id( repository.id ) )}">Browse or delete repository files</a>
%endif
<a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), file_type='gz' )}">Download as a .tar.gz file</a><a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), file_type='bz2' )}">Download as a .tar.bz2 file</a>
--- a/templates/webapps/community/repository/upload.mako Mon Jun 20 17:02:51 2011 -0400
+++ b/templates/webapps/community/repository/upload.mako Tue Jun 21 09:38:06 2011 -0400
@@ -55,7 +55,7 @@
<a class="action-button" href="${h.url_for( controller='repository', action='view_changelog', id=trans.app.security.encode_id( repository.id ) )}">View change log</a>
%endif
%if can_browse_contents:
- <a class="action-button" href="${h.url_for( controller='repository', action='browse_repository', id=trans.app.security.encode_id( repository.id ) )}">Browse repository</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='browse_repository', id=trans.app.security.encode_id( repository.id ) )}">Browse or delete repository files</a>
%endif
</div></ul>
@@ -106,7 +106,7 @@
%endif
</div><div class="toolParamHelp" style="clear: both;">
- This is the commit message for the mercurial change set that will be created by this upload
+ This is the commit message for the mercurial change set that will be created by this upload.
</div><div style="clear: both"></div></div>
--- a/templates/webapps/community/repository/view_changelog.mako Mon Jun 20 17:02:51 2011 -0400
+++ b/templates/webapps/community/repository/view_changelog.mako Tue Jun 21 09:38:06 2011 -0400
@@ -48,7 +48,7 @@
<a class="action-button" href="${h.url_for( controller='repository', action='rate_repository', id=trans.app.security.encode_id( repository.id ) )}">Rate repository</a>
%endif
%if can_browse_contents:
- <a class="action-button" href="${h.url_for( controller='repository', action='browse_repository', id=trans.app.security.encode_id( repository.id ) )}">Browse repository</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='browse_repository', id=trans.app.security.encode_id( repository.id ) )}">Browse or delete repository files</a>
%endif
<a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), file_type='gz' )}">Download as a .tar.gz file</a><a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), file_type='bz2' )}">Download as a .tar.bz2 file</a>
--- a/templates/webapps/community/repository/view_changeset.mako Mon Jun 20 17:02:51 2011 -0400
+++ b/templates/webapps/community/repository/view_changeset.mako Tue Jun 21 09:38:06 2011 -0400
@@ -52,7 +52,7 @@
<a class="action-button" href="${h.url_for( controller='repository', action='rate_repository', id=trans.app.security.encode_id( repository.id ) )}">Rate repository</a>
%endif
%if can_browse_contents:
- <a class="action-button" href="${h.url_for( controller='repository', action='browse_repository', id=trans.app.security.encode_id( repository.id ) )}">Browse repository</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='browse_repository', id=trans.app.security.encode_id( repository.id ) )}">Browse or delete repository files</a>
%endif
<a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), file_type='gz' )}">Download as a .tar.gz file</a><a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), file_type='bz2' )}">Download as a .tar.bz2 file</a>
--- a/templates/webapps/community/repository/view_repository.mako Mon Jun 20 17:02:51 2011 -0400
+++ b/templates/webapps/community/repository/view_repository.mako Tue Jun 21 09:38:06 2011 -0400
@@ -74,7 +74,7 @@
<a class="action-button" href="${h.url_for( controller='repository', action='rate_repository', id=trans.app.security.encode_id( repository.id ) )}">Rate repository</a>
%endif
%if can_browse_contents:
- <a class="action-button" href="${h.url_for( controller='repository', action='browse_repository', id=trans.app.security.encode_id( repository.id ) )}">Browse repository</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='browse_repository', id=trans.app.security.encode_id( repository.id ) )}">Browse or delete repository files</a>
%endif
<a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), file_type='gz' )}">Download as a .tar.gz file</a><a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), file_type='bz2' )}">Download as a .tar.bz2 file</a>
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: natefoo: Add the download/save icon to errored datasets which contain data. Fixes #207 and #583.
by Bitbucket 20 Jun '11
by Bitbucket 20 Jun '11
20 Jun '11
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/3fb285cb031d/
changeset: 3fb285cb031d
user: natefoo
date: 2011-06-20 23:02:51
summary: Add the download/save icon to errored datasets which contain data. Fixes #207 and #583.
affected #: 1 file (50 bytes)
--- a/templates/root/history_common.mako Wed May 25 17:26:36 2011 +0100
+++ b/templates/root/history_common.mako Mon Jun 20 17:02:51 2011 -0400
@@ -1,9 +1,35 @@
<% _=n_ %>
+
+<%def name="render_download_links( data, dataset_id )">
+ <%
+ from galaxy.datatypes.metadata import FileParameter
+ %>
+ %if not data.purged:
+ ## Check for downloadable metadata files
+ <% meta_files = [ k for k in data.metadata.spec.keys() if isinstance( data.metadata.spec[k].param, FileParameter ) ] %>
+ %if meta_files:
+ <div popupmenu="dataset-${dataset_id}-popup">
+ <a class="action-button" href="${h.url_for( controller='dataset', action='display', dataset_id=dataset_id, \
+ to_ext=data.ext )}">Download Dataset</a>
+ <a>Additional Files</a>
+ %for file_type in meta_files:
+ <a class="action-button" href="${h.url_for( controller='dataset', action='get_metadata_file', \
+ hda_id=dataset_id, metadata_name=file_type )}">Download ${file_type}</a>
+ %endfor
+ </div>
+ <div style="float:left;" class="menubutton split popup" id="dataset-${dataset_id}-popup">
+ %endif
+ <a href="${h.url_for( controller='dataset', action='display', dataset_id=dataset_id, to_ext=data.ext )}" title="Download" class="icon-button disk tooltip"></a>
+ %if meta_files:
+ </div>
+ %endif
+ %endif
+</%def>
+
## Render the dataset `data` as history item, using `hid` as the displayed id
<%def name="render_dataset( data, hid, show_deleted_on_refresh = False, for_editing = True, display_structured = False )"><%
dataset_id = trans.security.encode_id( data.id )
- from galaxy.datatypes.metadata import FileParameter
if data.state in ['no state','',None]:
data_state = "queued"
@@ -126,6 +152,9 @@
</div><div><a href="${h.url_for( controller='dataset', action='errors', id=data.id )}" target="galaxy_main" title="View or report this error" class="icon-button bug tooltip"></a>
+ %if data.has_data():
+ ${render_download_links( data, dataset_id )}
+ %endif
<a href="${h.url_for( controller='dataset', action='show_params', dataset_id=dataset_id )}" target="galaxy_main" title="View Details" class="icon-button information tooltip"></a>
%if for_editing:
<a href="${h.url_for( controller='tool_runner', action='rerun', id=data.id )}" target="galaxy_main" title="Run this job again" class="icon-button arrow-circle tooltip"></a>
@@ -169,26 +198,7 @@
%endif
<div>
%if data.has_data():
- %if not data.purged:
- ## Check for downloadable metadata files
- <% meta_files = [ k for k in data.metadata.spec.keys() if isinstance( data.metadata.spec[k].param, FileParameter ) ] %>
- %if meta_files:
- <div popupmenu="dataset-${dataset_id}-popup">
- <a class="action-button" href="${h.url_for( controller='dataset', action='display', dataset_id=dataset_id, \
- to_ext=data.ext )}">Download Dataset</a>
- <a>Additional Files</a>
- %for file_type in meta_files:
- <a class="action-button" href="${h.url_for( controller='dataset', action='get_metadata_file', \
- hda_id=dataset_id, metadata_name=file_type )}">Download ${file_type}</a>
- %endfor
- </div>
- <div style="float:left;" class="menubutton split popup" id="dataset-${dataset_id}-popup">
- %endif
- <a href="${h.url_for( controller='dataset', action='display', dataset_id=dataset_id, to_ext=data.ext )}" title="Download" class="icon-button disk tooltip"></a>
- %if meta_files:
- </div>
- %endif
- %endif
+ ${render_download_links( data, dataset_id )}
<a href="${h.url_for( controller='dataset', action='show_params', dataset_id=dataset_id )}" target="galaxy_main" title="View Details" class="icon-button information tooltip"></a>
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
2 new changesets in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/80b92e7b5d8c/
changeset: 80b92e7b5d8c
user: natefoo
date: 2011-06-20 19:43:19
summary: Make the ability for users to purge their own data conditional on a config variable. Due to limitations in the grid framework, the button can't be removed from the history grid, but clicking it just does the same thing as delete but adds a message explaining that the purge operation wasn't performed.
affected #: 6 files (1.3 KB)
--- a/lib/galaxy/config.py Fri Jun 17 16:45:25 2011 -0400
+++ b/lib/galaxy/config.py Mon Jun 20 13:43:19 2011 -0400
@@ -61,6 +61,7 @@
self.require_login = string_as_bool( kwargs.get( "require_login", "False" ) )
self.allow_user_creation = string_as_bool( kwargs.get( "allow_user_creation", "True" ) )
self.allow_user_deletion = string_as_bool( kwargs.get( "allow_user_deletion", "False" ) )
+ self.allow_user_dataset_purge = string_as_bool( kwargs.get( "allow_user_dataset_purge", "False" ) )
self.new_user_dataset_access_role_default_private = string_as_bool( kwargs.get( "new_user_dataset_access_role_default_private", "False" ) )
self.template_path = resolve_path( kwargs.get( "template_path", "templates" ), self.root )
self.template_cache = resolve_path( kwargs.get( "template_cache_path", "database/compiled_templates" ), self.root )
--- a/lib/galaxy/web/controllers/dataset.py Fri Jun 17 16:45:25 2011 -0400
+++ b/lib/galaxy/web/controllers/dataset.py Mon Jun 20 13:43:19 2011 -0400
@@ -746,12 +746,16 @@
@web.expose
def purge( self, trans, id ):
+ if not trans.app.config.allow_user_dataset_purge:
+ raise Exception( "Removal of datasets by users is not allowed in this Galaxy instance. Please contact your Galaxy administrator." )
if self._purge( trans, id ):
return trans.response.send_redirect( web.url_for( controller='root', action='history', show_deleted = True ) )
raise Exception( "Error removing disk file" )
@web.expose
def purge_async( self, trans, id ):
+ if not trans.app.config.allow_user_dataset_purge:
+ raise Exception( "Removal of datasets by users is not allowed in this Galaxy instance. Please contact your Galaxy administrator." )
if self._purge( trans, id ):
return "OK"
raise Exception( "Error removing disk file" )
--- a/lib/galaxy/web/controllers/history.py Fri Jun 17 16:45:25 2011 -0400
+++ b/lib/galaxy/web/controllers/history.py Mon Jun 20 13:43:19 2011 -0400
@@ -270,7 +270,7 @@
trans.new_history()
trans.log_event( "History (%s) marked as deleted" % history.name )
n_deleted += 1
- if purge:
+ if purge and trans.app.config.allow_user_dataset_purge:
for hda in history.datasets:
hda.purged = True
trans.sa_session.add( hda )
@@ -285,8 +285,10 @@
trans.sa_session.flush()
if n_deleted:
part = "Deleted %d %s" % ( n_deleted, iff( n_deleted != 1, "histories", "history" ) )
- if purge:
+ if purge and trans.app.config.allow_user_dataset_purge:
part += " and removed %s datasets from disk" % iff( n_deleted != 1, "their", "its" )
+ elif purge:
+ part += " but the datasets were not removed from disk because that feature is not enabled in this Galaxy instance"
message_parts.append( "%s. " % part )
if deleted_current:
message_parts.append( "Your active history was deleted, a new empty history is now active. " )
@@ -1213,4 +1215,4 @@
trans.set_history( hist )
return trans.response.send_redirect( url_for( "/" ) )
-
\ No newline at end of file
+
--- a/lib/galaxy/web/controllers/root.py Fri Jun 17 16:45:25 2011 -0400
+++ b/lib/galaxy/web/controllers/root.py Mon Jun 20 13:43:19 2011 -0400
@@ -504,6 +504,8 @@
@web.expose
def purge( self, trans, id = None, show_deleted_on_refresh = False, **kwd ):
+ if not trans.app.config.allow_user_dataset_purge:
+ return trans.show_error_message( "Removal of datasets by users is not allowed in this Galaxy instance. Please contact your Galaxy administrator." )
hda = trans.sa_session.query( self.app.model.HistoryDatasetAssociation ).get( int( id ) )
if bool( hda.dataset.active_history_associations or hda.dataset.library_associations ):
return trans.show_error_message( "Unable to purge: LDDA(s) or active HDA(s) exist" )
--- a/templates/root/history_common.mako Fri Jun 17 16:45:25 2011 -0400
+++ b/templates/root/history_common.mako Mon Jun 20 13:43:19 2011 -0400
@@ -23,7 +23,12 @@
%if data.dataset.purged or data.purged:
This dataset has been deleted and removed from disk.
%else:
- This dataset has been deleted. Click <a href="${h.url_for( controller='dataset', action='undelete', id=data.id )}" class="historyItemUndelete" id="historyItemUndeleter-${data.id}" target="galaxy_history">here</a> to undelete or <a href="${h.url_for( controller='dataset', action='purge', id=data.id )}" class="historyItemPurge" id="historyItemPurger-${data.id}" target="galaxy_history">here</a> to immediately remove from disk.
+ This dataset has been deleted. Click <a href="${h.url_for( controller='dataset', action='undelete', id=data.id )}" class="historyItemUndelete" id="historyItemUndeleter-${data.id}" target="galaxy_history">here</a> to undelete
+ %if trans.app.config.allow_user_dataset_purge:
+ or <a href="${h.url_for( controller='dataset', action='purge', id=data.id )}" class="historyItemPurge" id="historyItemPurger-${data.id}" target="galaxy_history">here</a> to immediately remove it from disk.
+ %else:
+ it.
+ %endif
%endif
</strong></div>
%endif
--- a/universe_wsgi.ini.sample Fri Jun 17 16:45:25 2011 -0400
+++ b/universe_wsgi.ini.sample Mon Jun 20 13:43:19 2011 -0400
@@ -401,6 +401,11 @@
# Allow administrators to delete accounts.
#allow_user_deletion = False
+# Allow users to remove their datasets from disk immediately (otherwise,
+# datasets will be removed after a time period specified by an administrator in
+# the cleanup scripts run via cron)
+#allow_user_dataset_purge = False
+
# By default, users' data will be public, but setting this to True will cause
# it to be private. Does not affect existing users and data, only ones created
# after this option is set. Users may still change their default back to
http://bitbucket.org/galaxy/galaxy-central/changeset/e74e89a4c03a/
changeset: e74e89a4c03a
user: peterjc
date: 2011-05-25 18:26:36
summary: Cope with white space at start of command after processing template (see issue #159)
affected #: 1 file (113 bytes)
--- a/lib/galaxy/tools/__init__.py Mon Jun 20 13:43:19 2011 -0400
+++ b/lib/galaxy/tools/__init__.py Wed May 25 17:26:36 2011 +0100
@@ -379,15 +379,10 @@
command = root.find("command")
if command is not None and command.text is not None:
self.command = command.text.lstrip() # get rid of leading whitespace
- interpreter = command.get("interpreter")
- if interpreter:
- # TODO: path munging for cluster/dataset server relocatability
- executable = self.command.split()[0]
- abs_executable = os.path.abspath(os.path.join(self.tool_dir, executable))
- self.command = self.command.replace(executable, abs_executable, 1)
- self.command = interpreter + " " + self.command
else:
self.command = ''
+ # Must pre-pend this AFTER processing the cheetah command template
+ self.interpreter = command.get("interpreter", None)
# Parameters used to build URL for redirection to external app
redirect_url_params = root.find( "redirect_url_params" )
if redirect_url_params is not None and redirect_url_params.text is not None:
@@ -1588,12 +1583,18 @@
try:
# Substituting parameters into the command
command_line = fill_template( self.command, context=param_dict )
- # Remove newlines from command line
- command_line = command_line.replace( "\n", " " ).replace( "\r", " " )
+ # Remove newlines from command line, and any leading/trailing white space
+ command_line = command_line.replace( "\n", " " ).replace( "\r", " " ).strip()
except Exception, e:
# Modify exception message to be more clear
#e.args = ( 'Error substituting into command line. Params: %r, Command: %s' % ( param_dict, self.command ) )
raise
+ if self.interpreter:
+ # TODO: path munging for cluster/dataset server relocatability
+ executable = command_line.split()[0]
+ abs_executable = os.path.abspath(os.path.join(self.tool_dir, executable))
+ command_line = command_line.replace(executable, abs_executable, 1)
+ command_line = self.interpreter + " " + command_line
return command_line
def build_dependency_shell_commands( self ):
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
17 Jun '11
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/d1f2d2e5246a/
changeset: d1f2d2e5246a
user: kanwei
date: 2011-06-17 22:45:25
summary: Escaping in tests should be more specific
affected #: 1 file (6 bytes)
--- a/test/base/twilltestcase.py Fri Jun 17 16:16:28 2011 -0400
+++ b/test/base/twilltestcase.py Fri Jun 17 16:45:25 2011 -0400
@@ -242,10 +242,10 @@
self.visit_page( "history" )
for subpatt in patt.split():
try:
- tc.find( escape(subpatt) )
+ tc.find( subpatt )
except:
fname = self.write_temp_file( tc.browser.get_html() )
- errmsg = "no match to '%s'\npage content written to '%s'" % ( escape(subpatt), fname )
+ errmsg = "no match to '%s'\npage content written to '%s'" % ( subpatt, fname )
raise AssertionError( errmsg )
self.home()
def clear_history( self ):
@@ -384,7 +384,7 @@
"""Switches to a history in the current list of histories"""
self.visit_url( "%s/history/list?operation=switch&id=%s" % ( self.url, id ) )
if name:
- self.check_history_for_string( name )
+ self.check_history_for_string( escape( name ) )
self.home()
def view_stored_active_histories( self, strings_displayed=[] ):
self.home()
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: natefoo: Missing migration script from the last commit.
by Bitbucket 17 Jun '11
by Bitbucket 17 Jun '11
17 Jun '11
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/4e3f43848b51/
changeset: 4e3f43848b51
user: natefoo
date: 2011-06-17 22:16:28
summary: Missing migration script from the last commit.
affected #: 1 file (0 bytes)
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: natefoo: Library datasets can now be job inputs - needed to be able to use the deferred job runner and transfer manager with set_metadata_externally = True.
by Bitbucket 17 Jun '11
by Bitbucket 17 Jun '11
17 Jun '11
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/e04154ed4639/
changeset: e04154ed4639
user: natefoo
date: 2011-06-17 22:06:17
summary: Library datasets can now be job inputs - needed to be able to use the deferred job runner and transfer manager with set_metadata_externally = True.
affected #: 7 files (2.6 KB)
--- a/lib/galaxy/jobs/__init__.py Fri Oct 22 14:30:58 2010 +0100
+++ b/lib/galaxy/jobs/__init__.py Fri Jun 17 16:06:17 2011 -0400
@@ -229,7 +229,7 @@
return JOB_DELETED
elif job.state == model.Job.states.ERROR:
return JOB_ADMIN_DELETED
- for dataset_assoc in job.input_datasets:
+ for dataset_assoc in job.input_datasets + job.input_library_datasets:
idata = dataset_assoc.dataset
if not idata:
continue
@@ -330,6 +330,7 @@
# Restore input / output data lists
inp_data = dict( [ ( da.name, da.dataset ) for da in job.input_datasets ] )
out_data = dict( [ ( da.name, da.dataset ) for da in job.output_datasets ] )
+ inp_data.update( [ ( da.name, da.dataset ) for da in job.input_library_datasets ] )
out_data.update( [ ( da.name, da.dataset ) for da in job.output_library_datasets ] )
# Set up output dataset association for export history jobs. Because job
@@ -614,6 +615,7 @@
# custom post process setup
inp_data = dict( [ ( da.name, da.dataset ) for da in job.input_datasets ] )
out_data = dict( [ ( da.name, da.dataset ) for da in job.output_datasets ] )
+ inp_data.update( [ ( da.name, da.dataset ) for da in job.input_library_datasets ] )
out_data.update( [ ( da.name, da.dataset ) for da in job.output_library_datasets ] )
param_dict = dict( [ ( p.name, p.value ) for p in job.parameters ] ) # why not re-use self.param_dict here? ##dunno...probably should, this causes tools.parameters.basic.UnvalidatedValue to be used in following methods instead of validated and transformed values during i.e. running workflows
param_dict = self.tool.params_from_strings( param_dict, self.app )
@@ -665,7 +667,7 @@
def get_input_fnames( self ):
job = self.get_job()
filenames = []
- for da in job.input_datasets: #da is JobToInputDatasetAssociation object
+ for da in job.input_datasets + job.input_library_datasets: #da is JobToInputDatasetAssociation object
if da.dataset:
filenames.append( da.dataset.file_name )
#we will need to stage in metadata file names also
@@ -861,9 +863,10 @@
self.tool.handle_unvalidated_param_values( incoming, self.app )
# Restore input / output data lists
inp_data = dict( [ ( da.name, da.dataset ) for da in job.input_datasets ] )
+ out_data = dict( [ ( da.name, da.dataset ) for da in job.output_datasets ] )
+ inp_data.update( [ ( da.name, da.dataset ) for da in job.input_library_datasets ] )
+ out_data.update( [ ( da.name, da.dataset ) for da in job.output_library_datasets ] )
# DBTODO New method for generating command line for a task?
- out_data = dict( [ ( da.name, da.dataset ) for da in job.output_datasets ] )
- out_data.update( [ ( da.name, da.dataset ) for da in job.output_library_datasets ] )
# These can be passed on the command line if wanted as $userId $userEmail
if job.history and job.history.user: # check for anonymous user!
userId = '%d' % job.history.user.id
--- a/lib/galaxy/jobs/deferred/__init__.py Fri Oct 22 14:30:58 2010 +0100
+++ b/lib/galaxy/jobs/deferred/__init__.py Fri Jun 17 16:06:17 2011 -0400
@@ -98,14 +98,14 @@
job_state = self.plugins[job.plugin].check_job( job )
except Exception, e:
self.__fail_job( job )
- log.error( 'Set deferred job %s to error because of an exception in check_job(): %s' % ( job.id, str( e ) ) )
+ log.exception( 'Set deferred job %s to error because of an exception in check_job(): %s' % ( job.id, str( e ) ) )
continue
if job_state == self.job_states.READY:
try:
self.plugins[job.plugin].run_job( job )
except Exception, e:
self.__fail_job( job )
- log.error( 'Set deferred job %s to error because of an exception in run_job(): %s' % ( job.id, str( e ) ) )
+ log.exception( 'Set deferred job %s to error because of an exception in run_job(): %s' % ( job.id, str( e ) ) )
continue
elif job_state == self.job_states.INVALID:
self.__fail_job( job )
@@ -160,8 +160,14 @@
self.app = app
self.sa_session = app.model.context.current
self.dummy = Dummy()
- self.history = history
- self.user = user
+ if not history:
+ self.history = Dummy()
+ else:
+ self.history = history
+ if not user:
+ self.user = Dummy()
+ else:
+ self.user = user
self.model = app.model
def get_galaxy_session( self ):
return self.dummy
--- a/lib/galaxy/jobs/deferred/data_transfer.py Fri Oct 22 14:30:58 2010 +0100
+++ b/lib/galaxy/jobs/deferred/data_transfer.py Fri Jun 17 16:06:17 2011 -0400
@@ -93,12 +93,18 @@
# In this case, job.params will be a dictionary that contains a key named 'result'. The value
# of the result key is a dictionary that looks something like:
# {'sample_dataset_id': '8', 'status': 'Not started', 'protocol': 'scp', 'name': '3.bed',
- # 'file_path': '/tmp/library/3.bed', 'host': '127.0.0.1', 'sample_id': 8, 'external_service_id': 2,
- # 'password': 'galaxy', 'user_name': 'gvk', 'error_msg': '', 'size': '8.0K'}
- result_dict = job.params[ 'result' ]
+ # 'file_path': '/data/library/3.bed', 'host': '127.0.0.1', 'sample_id': 8, 'external_service_id': 2,
+ # 'local_path': '/tmp/kjl2Ss4', 'password': 'galaxy', 'user_name': 'gvk', 'error_msg': '', 'size': '8.0K'}
+ try:
+ tj = self.sa_session.query( self.app.model.TransferJob ).get( int( job.params['transfer_job_id'] ) )
+ result_dict = tj.params
+ result_dict['local_path'] = tj.path
+ except Exception, e:
+ log.error( "Updated transfer result unavailable, using old result. Error was: %s" % str( e ) )
+ result_dict = job.params[ 'result' ]
library_dataset_name = result_dict[ 'name' ]
# Determine the data format (see the relevant TODO item in the manual_data_transfer plugin)..
- extension = sniff.guess_ext( result_dict[ 'file_path' ], sniff_order=self.app.datatypes_registry.sniff_order )
+ extension = sniff.guess_ext( result_dict[ 'local_path' ], sniff_order=self.app.datatypes_registry.sniff_order )
self._update_sample_dataset_status( protocol=job.params[ 'protocol' ],
sample_id=int( job.params[ 'sample_id' ] ),
result_dict=result_dict,
@@ -132,7 +138,9 @@
setattr( ldda.metadata, name, spec.unwrap( spec.get( 'default' ) ) )
if self.app.config.set_metadata_externally:
self.app.datatypes_registry.set_external_metadata_tool.tool_action.execute( self.app.datatypes_registry.set_external_metadata_tool,
- FakeTrans( self.app ),
+ FakeTrans( self.app,
+ history=sample.history,
+ user=sample.request.user ),
incoming = { 'input1':ldda } )
else:
ldda.set_meta()
--- a/lib/galaxy/jobs/transfer_manager.py Fri Oct 22 14:30:58 2010 +0100
+++ b/lib/galaxy/jobs/transfer_manager.py Fri Jun 17 16:06:17 2011 -0400
@@ -106,6 +106,7 @@
error = dict( code=256, message='Error connecting to transfer daemon', data=str( e ) )
rval.append( dict( transfer_job_id=tj.id, state=tj.state, error=error ) )
else:
+ self.sa_session.refresh( tj )
rval.append( dict( transfer_job_id=tj.id, state=tj.state ) )
for tj_state in rval:
if tj_state['state'] in self.app.model.TransferJob.terminal_states:
--- a/lib/galaxy/model/__init__.py Fri Oct 22 14:30:58 2010 +0100
+++ b/lib/galaxy/model/__init__.py Fri Jun 17 16:06:17 2011 -0400
@@ -95,6 +95,7 @@
self.parameters = []
self.input_datasets = []
self.output_datasets = []
+ self.input_library_datasets = []
self.output_library_datasets = []
self.state = Job.states.NEW
self.info = None
@@ -109,6 +110,8 @@
self.input_datasets.append( JobToInputDatasetAssociation( name, dataset ) )
def add_output_dataset( self, name, dataset ):
self.output_datasets.append( JobToOutputDatasetAssociation( name, dataset ) )
+ def add_input_library_dataset( self, name, dataset ):
+ self.input_library_datasets.append( JobToInputLibraryDatasetAssociation( name, dataset ) )
def add_output_library_dataset( self, name, dataset ):
self.output_library_datasets.append( JobToOutputLibraryDatasetAssociation( name, dataset ) )
def add_post_job_action(self, pja):
@@ -215,6 +218,11 @@
self.name = name
self.dataset = dataset
+class JobToInputLibraryDatasetAssociation( object ):
+ def __init__( self, name, dataset ):
+ self.name = name
+ self.dataset = dataset
+
class JobToOutputLibraryDatasetAssociation( object ):
def __init__( self, name, dataset ):
self.name = name
--- a/lib/galaxy/model/mapping.py Fri Oct 22 14:30:58 2010 +0100
+++ b/lib/galaxy/model/mapping.py Fri Jun 17 16:06:17 2011 -0400
@@ -370,6 +370,12 @@
Column( "dataset_id", Integer, ForeignKey( "history_dataset_association.id" ), index=True ),
Column( "name", String(255) ) )
+JobToInputLibraryDatasetAssociation.table = Table( "job_to_input_library_dataset", metadata,
+ Column( "id", Integer, primary_key=True ),
+ Column( "job_id", Integer, ForeignKey( "job.id" ), index=True ),
+ Column( "ldda_id", Integer, ForeignKey( "library_dataset_dataset_association.id" ), index=True ),
+ Column( "name", String(255) ) )
+
JobToOutputLibraryDatasetAssociation.table = Table( "job_to_output_library_dataset", metadata,
Column( "id", Integer, primary_key=True ),
Column( "job_id", Integer, ForeignKey( "job.id" ), index=True ),
@@ -1376,6 +1382,9 @@
assign_mapper( context, JobToOutputDatasetAssociation, JobToOutputDatasetAssociation.table,
properties=dict( job=relation( Job ), dataset=relation( HistoryDatasetAssociation, lazy=False ) ) )
+assign_mapper( context, JobToInputLibraryDatasetAssociation, JobToInputLibraryDatasetAssociation.table,
+ properties=dict( job=relation( Job ), dataset=relation( LibraryDatasetDatasetAssociation, lazy=False ) ) )
+
assign_mapper( context, JobToOutputLibraryDatasetAssociation, JobToOutputLibraryDatasetAssociation.table,
properties=dict( job=relation( Job ), dataset=relation( LibraryDatasetDatasetAssociation, lazy=False ) ) )
@@ -1410,6 +1419,7 @@
input_datasets=relation( JobToInputDatasetAssociation ),
output_datasets=relation( JobToOutputDatasetAssociation ),
post_job_actions=relation( PostJobActionAssociation, lazy=False ),
+ input_library_datasets=relation( JobToInputLibraryDatasetAssociation ),
output_library_datasets=relation( JobToOutputLibraryDatasetAssociation ),
external_output_metadata = relation( JobExternalOutputMetadata, lazy = False ) ) )
--- a/lib/galaxy/tools/actions/metadata.py Fri Oct 22 14:30:58 2010 +0100
+++ b/lib/galaxy/tools/actions/metadata.py Fri Jun 17 16:06:17 2011 -0400
@@ -13,6 +13,12 @@
if isinstance( value, trans.app.model.HistoryDatasetAssociation ):
dataset = value
dataset_name = name
+ type = 'hda'
+ break
+ elif isinstance( value, trans.app.model.LibraryDatasetDatasetAssociation ):
+ dataset = value
+ dataset_name = name
+ type = 'ldda'
break
else:
raise Exception( 'The dataset to set metadata on could not be determined.' )
@@ -22,6 +28,8 @@
job.session_id = trans.get_galaxy_session().id
job.history_id = trans.history.id
job.tool_id = tool.id
+ if trans.user:
+ job.user_id = trans.user.id
start_job_state = job.state #should be job.states.NEW
try:
# For backward compatibility, some tools may not have versions yet.
@@ -50,7 +58,10 @@
for name, value in tool.params_to_strings( incoming, trans.app ).iteritems():
job.add_parameter( name, value )
#add the dataset to job_to_input_dataset table
- job.add_input_dataset( dataset_name, dataset )
+ if type == 'hda':
+ job.add_input_dataset( dataset_name, dataset )
+ elif type == 'ldda':
+ job.add_input_library_dataset( dataset_name, dataset )
#Need a special state here to show that metadata is being set and also allow the job to run
# i.e. if state was set to 'running' the set metadata job would never run, as it would wait for input (the dataset to set metadata on) to be in a ready state
dataset._state = dataset.states.SETTING_METADATA
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: peterjc: Support optional integer/float arguments (Fixes #403)
by Bitbucket 17 Jun '11
by Bitbucket 17 Jun '11
17 Jun '11
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/adcc600effa4/
changeset: adcc600effa4
user: peterjc
date: 2010-10-22 15:30:58
summary: Support optional integer/float arguments (Fixes #403)
affected #: 1 file (1.0 KB)
--- a/lib/galaxy/tools/parameters/basic.py Fri Jun 17 15:31:07 2011 -0400
+++ b/lib/galaxy/tools/parameters/basic.py Fri Oct 22 14:30:58 2010 +0100
@@ -36,6 +36,8 @@
self.html = "no html set"
self.repeat = param.get("repeat", None)
self.condition = param.get( "condition", None )
+ # Optional DataToolParameters are used in tools like GMAJ and LAJ
+ self.optional = string_as_bool( param.get( 'optional', False ) )
self.validators = []
for elem in param.findall("validator"):
self.validators.append( validation.Validator.from_element( self, elem ) )
@@ -131,7 +133,11 @@
return value
def to_param_dict_string( self, value, other_values={} ):
- value = str( value )
+ """Called via __str__ when used in the Cheetah template"""
+ if value is None:
+ value = ""
+ else:
+ value = str( value )
if self.tool is None or self.tool.options.sanitize:
if self.sanitizer:
value = self.sanitizer.sanitize_param( value )
@@ -140,6 +146,8 @@
return value
def validate( self, value, history=None ):
+ if value=="" and self.optional:
+ return
for validator in self.validators:
validator.validate( value, history )
@@ -226,9 +234,22 @@
try:
return int( value )
except:
+ if not value and self.optional:
+ return ""
raise ValueError( "An integer is required" )
+ def to_string( self, value, app ):
+ """Convert a value to a string representation suitable for persisting"""
+ if value is None:
+ return ""
+ else:
+ return str( value )
def to_python( self, value, app ):
- return int( value )
+ try:
+ return int( value )
+ except Exception, err:
+ if not value and self.optional:
+ return None
+ raise err
def get_initial_value( self, trans, context ):
if self.value:
return int( self.value )
@@ -281,10 +302,23 @@
def from_html( self, value, trans=None, other_values={} ):
try:
return float( value )
- except:
+ except:
+ if not value and self.optional:
+ return ""
raise ValueError( "A real number is required" )
+ def to_string( self, value, app ):
+ """Convert a value to a string representation suitable for persisting"""
+ if value is None:
+ return ""
+ else:
+ return str( value )
def to_python( self, value, app ):
- return float( value )
+ try:
+ return float( value )
+ except Exception, err:
+ if not value and self.optional:
+ return None
+ raise err
def get_initial_value( self, trans, context ):
try:
return float( self.value )
@@ -1259,8 +1293,6 @@
formats.append( tool.app.datatypes_registry.get_datatype_by_extension( extension.lower() ).__class__ )
self.formats = tuple( formats )
self.multiple = string_as_bool( elem.get( 'multiple', False ) )
- # Optional DataToolParameters are used in tools like GMAJ and LAJ
- self.optional = string_as_bool( elem.get( 'optional', False ) )
# TODO: Enhance dynamic options for DataToolParameters. Currently,
# only the special case key='build' of type='data_meta' is
# a valid filter
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/4a722839e77a/
changeset: 4a722839e77a
user: kanwei
date: 2011-06-17 21:31:07
summary: typo
affected #: 1 file (1 byte)
--- a/templates/workflow/list.mako Fri Jun 17 15:30:01 2011 -0400
+++ b/templates/workflow/list.mako Fri Jun 17 15:31:07 2011 -0400
@@ -121,5 +121,5 @@
<span>Configure your workflow menu</span></a></div>
- </div
+ </div></%def>
\ No newline at end of file
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0