def make_public(self, id): """ Controller allowing existing model runs to be made public :param id: ID of model run to make public :return: redirect to the page you came from """ if not request.method == 'POST': helpers.error_flash("Making a model run public must be a post") redirect(url(controller='model_run', action='index')) helpers.success_flash("Model run has been made public") self._model_run_service.make_public_model(self.current_user, id) redirect_back_to_came_from_for_model_run(id, request.params)
bng_easting = request.params['bng_easting'] bng_northing = request.params['bng_northing'] json_response = {} try: lat, lon = OSGB36toWGS84(float(bng_easting), float(bng_northing)) json_response['lat'] = lat json_response['lon'] = lon except Exception: json_response['is_error'] = True return json_response def duplicate(self, id=None): """ Duplicate a model run :param id: model run to duplicate :return: redirect """ if not request.method == 'POST': helpers.error_flash("Model run duplication must be a post") redirect(url(controller='model_run', action='index')) try: self._model_run_service.duplicate_run_model(id, self.current_user) redirect(url=url(controller='model_run', action='submit')) except NoResultFound: helpers.error_flash("The model run was not duplicated because it no longer exists.") except ServiceException, ex: helpers.error_flash("The model run was not duplicated: %s" % ex.message) redirect_back_to_came_from_for_model_run(id, request.params)