'Sets up a dataset permissions so it is viewable at an external site'

@web.expose
def display_at(self, trans, dataset_id, filename=None, **kwd):

    if (not trans.app.config.enable_old_display_applications):
        return trans.show_error_message('This    method    of    accessing    external    display    applications    has    been    disabled    by    a    Galaxy    administrator.')
    site = filename
    data = trans.sa_session.query(trans.app.model.HistoryDatasetAssociation).get(dataset_id)
    if (not data):
        raise paste.httpexceptions.HTTPRequestRangeNotSatisfiable(('Invalid    reference    dataset    id:    %s.' % str(dataset_id)))
    if (('display_url' not in kwd) or ('redirect_url' not in kwd)):
        return trans.show_error_message('Invalid    parameters    specified    for    "display    at"    link,    please    contact    a    Galaxy    administrator')
    try:
        redirect_url = (kwd['redirect_url'] % urllib.quote_plus(kwd['display_url']))
    except:
        redirect_url = kwd['redirect_url']
    if trans.app.security_agent.dataset_is_public(data.dataset):
        return trans.response.send_redirect(redirect_url)
    if self._can_access_dataset(trans, data):
        trans.app.host_security_agent.set_dataset_permissions(data, trans.user, site)
        return trans.response.send_redirect(redirect_url)
    else:
        return trans.show_error_message('You    are    not    allowed    to    view    this    dataset    at    external    sites.        Please    contact    your    Galaxy    administrator    to    acquire    management    permissions    for    this    dataset.')
