commit/galaxy-central: jgoecks: Do not try to display non-text datasets in collaboration framework.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/131f63d24221/ changeset: 131f63d24221 user: jgoecks date: 2013-02-18 15:46:35 summary: Do not try to display non-text datasets in collaboration framework. affected #: 2 files diff -r 09c81e81952d4768d63fde4840f31958d8e23041 -r 131f63d242216522ffb06cada3684fbf93fe9254 lib/galaxy/web/base/controller.py --- a/lib/galaxy/web/base/controller.py +++ b/lib/galaxy/web/base/controller.py @@ -20,6 +20,7 @@ from galaxy.exceptions import * from galaxy.model import NoConverterException, ConverterDependencyException from galaxy.datatypes.interval import ChromatinInteractions +from galaxy.datatypes.data import Text from Cheetah.Template import Template @@ -270,17 +271,22 @@ def get_data( self, dataset, preview=True ): """ Gets a dataset's data. """ + # Get data from file, truncating if necessary. truncated = False dataset_data = None if os.path.exists( dataset.file_name ): - max_peek_size = 1000000 # 1 MB - if preview and os.stat( dataset.file_name ).st_size > max_peek_size: - dataset_data = open( dataset.file_name ).read(max_peek_size) - truncated = True + if isinstance( dataset.datatype, Text ): + max_peek_size = 1000000 # 1 MB + if preview and os.stat( dataset.file_name ).st_size > max_peek_size: + dataset_data = open( dataset.file_name ).read(max_peek_size) + truncated = True + else: + dataset_data = open( dataset.file_name ).read(max_peek_size) + truncated = False else: - dataset_data = open( dataset.file_name ).read(max_peek_size) - truncated = False + # For now, cannot get data from non-text datasets. + dataset_data = None return truncated, dataset_data def check_dataset_state( self, trans, dataset ): diff -r 09c81e81952d4768d63fde4840f31958d8e23041 -r 131f63d242216522ffb06cada3684fbf93fe9254 templates/webapps/galaxy/dataset/display.mako --- a/templates/webapps/galaxy/dataset/display.mako +++ b/templates/webapps/galaxy/dataset/display.mako @@ -61,7 +61,7 @@ <%def name="render_item( data, data_to_render )"> ## Chunkable data is rendered in JavaScript above; render unchunkable data below. - %if not data.datatype.CHUNKABLE: + %if not data.datatype.CHUNKABLE and data_to_render: %if truncated: <div class="warningmessagelarge"> This dataset is large and only the first megabyte is shown below. | @@ -70,6 +70,8 @@ %endif ## TODO: why is the default font size so small? <pre style="font-size: 135%">${ data_to_render | h }</pre> + %else: + <p align='center'>Cannot show dataset content</p> %endif </%def> 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