2 new changesets in galaxy-central: http://bitbucket.org/galaxy/galaxy-central/changeset/55af252cd550/ changeset: 55af252cd550 user: jgoecks date: 2011-06-17 19:16:34 summary: Enable importing of visualizations via a shallow copy: only a viz's config is copied, not its datasets. affected #: 2 files (1.1 KB) --- a/lib/galaxy/web/controllers/visualization.py Fri Jun 17 12:16:53 2011 -0400 +++ b/lib/galaxy/web/controllers/visualization.py Fri Jun 17 13:16:34 2011 -0400 @@ -87,7 +87,7 @@ @web.require_login( "use Galaxy visualizations", use_panels=True ) def index( self, trans, *args, **kwargs ): """ Lists user's saved visualizations. """ - return self.list( trans, args, kwargs ) + return self.list( trans, *args, **kwargs ) @web.expose @web.require_login() @@ -202,20 +202,39 @@ visualization = self.get_visualization( trans, id, check_ownership=False ) if visualization.importable == False: return trans.show_error_message( "The owner of this visualization has disabled imports via this link.<br>You can %s" % referer_message, use_panels=True ) - elif visualization.user == trans.user: - return trans.show_error_message( "You can't import this visualization because you own it.<br>You can %s" % referer_message, use_panels=True ) elif visualization.deleted: return trans.show_error_message( "You can't import this visualization because it has been deleted.<br>You can %s" % referer_message, use_panels=True ) else: - # Create imported visualization via copy. TODO: Visualizations use datasets -- do we need to check to ensure that - # datasets can be imported/viewed and/or copy datasets to user? + # + # Create imported visualization via copy. + # NOTE: a shallow copy is done: the config is copied as is but datasets + # are not copied nor are the dataset ids changed. This means that the + # user does not have a copy of the data in his/her history and the + # user who owns the datasets may delete them, making them inaccessible + # for the current user. + # TODO: + # -a deep copy is needed; + # -need to handle custom db keys. + # + imported_visualization = model.Visualization() - imported_visualization.title = "imported: " + visualization.title - imported_visualization.latest_revision = visualization.latest_revision + imported_visualization.title = visualization.title + imported_visualization.dbkey = visualization.dbkey + imported_visualization.type = visualization.type imported_visualization.user = trans.user - # Save new visualization. + + # And the first visualization revision + imported_visualization_revision = model.VisualizationRevision() + imported_visualization_revision.title = visualization.title + imported_visualization_revision.config = visualization.latest_revision.config + imported_visualization_revision.dbkey = visualization.dbkey + imported_visualization_revision.visualization = imported_visualization + imported_visualization.latest_revision = imported_visualization_revision + + # Persist session = trans.sa_session session.add( imported_visualization ) + session.add( imported_visualization_revision ) session.flush() # Redirect to load galaxy frames. --- a/templates/visualization/display.mako Fri Jun 17 12:16:53 2011 -0400 +++ b/templates/visualization/display.mako Fri Jun 17 13:16:34 2011 -0400 @@ -49,7 +49,12 @@ </%def><%def name="render_item_links( visualization )"> - + <a + href="${h.url_for( controller='/visualization', action='imp', id=trans.security.encode_id( visualization.id ) )}" + class="icon-button import" + ## Needed to overwide initial width so that link is floated left appropriately. + style="width: 100%" + title="Import visualization">Import visualization</a></%def><%def name="render_item( visualization, config )"> http://bitbucket.org/galaxy/galaxy-central/changeset/dc33340cad7d/ changeset: dc33340cad7d user: jgoecks date: 2011-06-17 19:16:53 summary: Merge. affected #: 1 file (8 bytes) --- a/lib/galaxy/datatypes/wsf.py Fri Jun 17 13:16:34 2011 -0400 +++ b/lib/galaxy/datatypes/wsf.py Fri Jun 17 13:16:53 2011 -0400 @@ -26,7 +26,7 @@ def set_meta( self, dataset, overwrite = True, **kwd ): - Tabular.set_meta( self, dataset, overwrite=overwrite, skip=1, max_data_lines=None, **kwd ) + Tabular.set_meta( self, dataset, overwrite=overwrite, max_data_lines=None, **kwd ) # these two if statements work around a potential bug in metadata.py if dataset.metadata.labels is None or dataset.metadata.labels == dataset.metadata.spec['labels'].no_value: self._set_column_labels_metadata( dataset ) 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.