'Copies a dataset and makes primary.'

@web.expose
def dataset_make_primary(self, trans, id=None):

    try:
        old_data = trans.sa_session.query(self.app.model.HistoryDatasetAssociation).get(id)
        new_data = old_data.copy()
        history = trans.get_history()
        history.add_dataset(new_data)
        trans.sa_session.add(new_data)
        trans.sa_session.flush()
        return trans.show_message('<p>Secondary    dataset    has    been    made    primary.</p>', refresh_frames=['history'])
    except:
        return trans.show_error_message('<p>Failed    to    make    secondary    dataset    primary.</p>')
