'Display dataset by username and slug; because datasets do not yet have slugs, the slug is the dataset\'s id.'

@web.expose
def display_by_username_and_slug(self, trans, username, slug, filename=None, preview=True):

    id = slug
    decoded_id = self.decode_id(id)
    dataset = self.hda_manager.get_accessible(decoded_id, trans.user)
    dataset = self.hda_manager.error_if_uploading(dataset)
    if dataset:
        if filename:
            return self.display(trans, dataset_id=slug, filename=filename)
        (truncated, dataset_data) = self.hda_manager.text_data(dataset, preview)
        dataset.annotation = self.get_item_annotation_str(trans.sa_session, dataset.history.user, dataset)
        first_chunk = None
        if dataset.datatype.CHUNKABLE:
            first_chunk = dataset.datatype.get_chunk(trans, dataset, 0)
        if (isinstance(dataset.datatype, datatypes.binary.Binary) or isinstance(dataset.datatype, datatypes.images.Image) or isinstance(dataset.datatype, datatypes.text.Html)):
            trans.response.set_content_type(dataset.get_mime())
            return open(dataset.file_name)
        else:
            user_item_rating = 0
            if trans.get_user():
                user_item_rating = self.get_user_item_rating(trans.sa_session, trans.get_user(), dataset)
                if user_item_rating:
                    user_item_rating = user_item_rating.rating
                else:
                    user_item_rating = 0
            (ave_item_rating, num_ratings) = self.get_ave_item_rating_data(trans.sa_session, dataset)
            return trans.fill_template_mako('/dataset/display.mako', item=dataset, item_data=dataset_data, truncated=truncated, user_item_rating=user_item_rating, ave_item_rating=ave_item_rating, num_ratings=num_ratings, first_chunk=first_chunk)
    else:
        raise web.httpexceptions.HTTPNotFound()
