details: http://www.bx.psu.edu/hg/galaxy/rev/00a558d5ad25 changeset: 3788:00a558d5ad25 user: jeremy goecks <jeremy.goecks@emory.edu> date: Sat May 15 11:25:05 2010 -0400 description: Enable images and binary datasets to work within the display framework. More work is needed to enable images to work well. diffstat: lib/galaxy/web/controllers/dataset.py | 10 +++++++++- 1 files changed, 9 insertions(+), 1 deletions(-) diffs (20 lines): diff -r 9ab8480354c7 -r 00a558d5ad25 lib/galaxy/web/controllers/dataset.py --- a/lib/galaxy/web/controllers/dataset.py Fri May 14 11:25:03 2010 -0400 +++ b/lib/galaxy/web/controllers/dataset.py Sat May 15 11:25:05 2010 -0400 @@ -472,7 +472,15 @@ if dataset: truncated, dataset_data = self.get_data( dataset, preview ) dataset.annotation = self.get_item_annotation_str( trans, dataset.history.user, dataset ) - return trans.fill_template_mako( "/dataset/display.mako", item=dataset, item_data=dataset_data, truncated=truncated ) + + # If data is binary or an image, stream without template; otherwise, use display template. + # TODO: figure out a way to display images in display template. + if isinstance(dataset.datatype, datatypes.binary.Binary) or isinstance(dataset.datatype, datatypes.images.Image): + mime = trans.app.datatypes_registry.get_mimetype_by_extension( dataset.extension.lower() ) + trans.response.set_content_type( mime ) + return open( dataset.file_name ) + else: + return trans.fill_template_mako( "/dataset/display.mako", item=dataset, item_data=dataset_data, truncated=truncated ) else: raise web.httpexceptions.HTTPNotFound()