def update_success(self, update_dict, raw=False):
        """ This method serves as an easy way to update your success attributes
        that are passed to the start Node rendering context, or passed back in
        JSON. It automatically recalls whether the last validation call was to
        json_validate or validate_render and modifys the correct dictionary
        accordingly.

        :param update_dict: The dictionary of values to update/add.
        :type data: dictionary

        :param raw: Whether you would like a pre-compiled JSON
            string returned, or the raw dictionary.
        :type raw: bool

        :return: Return value is either the new JSON string (or raw dict if
            requested) if json_validate was your last validation call, or a
            re-render of the form with updated error messages if validate_render
            was your last call.
        """

        if self._last_valid == 'render':
            try:
                self.start.errors[-1].update(update_dict)
            except IndexError:
                raise IndexError("Error updating your error dictionary for the "
                               "start Node. There were no errors to modify.")
            except AttributeError:
                raise AttributeError("This method is designed to update an "
                                     "error dictionary, yet your errors are "
                                     "not dictionaries")

            return self.render()

        # We're going to default to json render
        else:
            # Modify our last json dict
            try:
                self._last_raw_json['success_blob'].update(update_dict)
            except __HOLE__:
                raise KeyError("Either your json_validate method has not been "
                               "run yet, or your success_header_generate does"
                               " not produce output")

            # Continue the raw semantic...
            if raw:
                return self._last_raw_json
            else:
                return json.dumps(self._last_raw_json)
dataset/ETHPy150Open icook/yota/src/yota/__init__.py/Form.update_success