commit/galaxy-central: 2 new changesets
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.
participants (1)
-
Bitbucket