@utilities.arguments_not_none<EOL><INDENT>def update_grade(self, grade_form):<DEDENT>
<EOL>from dlkit.abstract_osid.grading.objects import GradeForm as ABCGradeForm<EOL>collection = JSONClientValidated('<STR_LIT>',<EOL>collection='<STR_LIT>',<EOL>runtime=self._runtime)<EOL>if not isinstance(grade_form, ABCGradeForm):<EOL><INDENT>raise errors.InvalidArgument('<STR_LIT>')<EOL><DEDENT>if not grade_form.is_for_update():<EOL><INDENT>raise errors.InvalidArgument('<STR_LIT>')<EOL><DEDENT>try:<EOL><INDENT>if self._forms[grade_form.get_id().get_identifier()] == UPDATED:<EOL><INDENT>raise errors.IllegalState('<STR_LIT>')<EOL><DEDENT><DEDENT>except KeyError:<EOL><INDENT>raise errors.Unsupported('<STR_LIT>')<EOL><DEDENT>if not grade_form.is_valid():<EOL><INDENT>raise errors.InvalidArgument('<STR_LIT>')<EOL><DEDENT>grade_system_id = Id(grade_form._my_map['<STR_LIT>']).get_identifier()<EOL>grade_system = collection.find_one(<EOL>{'<STR_LIT>': [{'<STR_LIT>': ObjectId(grade_system_id)},<EOL>{'<STR_LIT>' + self._catalog_name + '<STR_LIT>': {'<STR_LIT>': [str(self._catalog_id)]}}]})<EOL>index = <NUM_LIT:0><EOL>found = False<EOL>for i in grade_system['<STR_LIT>']:<EOL><INDENT>if i['<STR_LIT>'] == ObjectId(grade_form._my_map['<STR_LIT>']):<EOL><INDENT>grade_system['<STR_LIT>'].pop(index)<EOL>grade_system['<STR_LIT>'].insert(index, grade_form._my_map)<EOL>found = True<EOL>break<EOL><DEDENT>index += <NUM_LIT:1><EOL><DEDENT>if not found:<EOL><INDENT>raise errors.NotFound()<EOL><DEDENT>try:<EOL><INDENT>collection.save(grade_system)<EOL><DEDENT>except:  <EOL><INDENT>raise errors.OperationFailed()<EOL><DEDENT>self._forms[grade_form.get_id().get_identifier()] = UPDATED<EOL>from .objects import Grade<EOL>return Grade(<EOL>osid_object_map=grade_form._my_map,<EOL>runtime=self._runtime,<EOL>proxy=self._proxy)<EOL>
Updates an existing grade.

        arg:    grade_form (osid.grading.GradeForm): the form containing
                the elements to be updated
        raise:  IllegalState - ``grade_form`` already used in an update
                transaction
        raise:  InvalidArgument - the form contains an invalid value
        raise:  NullArgument - ``grade_id`` or ``grade_form`` is
                ``null``
        raise:  OperationFailed - unable to complete request
        raise:  PermissionDenied - authorization failure
        raise:  Unsupported - ``grade_form`` did not originate from
                ``get_grade_form_for_update()``
        *compliance: mandatory -- This method must be implemented.*