@exc.on_http_error(exc.GitlabUpdateError)<EOL><INDENT>def update(self, id=None, new_data={}, **kwargs):<DEDENT>
if id is None:<EOL><INDENT>path = self.path<EOL><DEDENT>else:<EOL><INDENT>path = '<STR_LIT>' % (self.path, id)<EOL><DEDENT>self._check_missing_update_attrs(new_data)<EOL>files = {}<EOL>types = getattr(self, '<STR_LIT>', {})<EOL>if types:<EOL><INDENT>new_data = new_data.copy()<EOL>for attr_name, type_cls in types.items():<EOL><INDENT>if attr_name in new_data.keys():<EOL><INDENT>type_obj = type_cls(new_data[attr_name])<EOL>if issubclass(type_cls, g_types.FileAttribute):<EOL><INDENT>k = type_obj.get_file_name(attr_name)<EOL>files[attr_name] = (k, new_data.pop(attr_name))<EOL><DEDENT>else:<EOL><INDENT>new_data[attr_name] = type_obj.get_for_api()<EOL><DEDENT><DEDENT><DEDENT><DEDENT>http_method = self._get_update_method()<EOL>return http_method(path, post_data=new_data, files=files, **kwargs)<EOL>
Update an object on the server.

        Args:
            id: ID of the object to update (can be None if not required)
            new_data: the update data for the object
            **kwargs: Extra options to send to the server (e.g. sudo)

        Returns:
            dict: The new object data (*not* a RESTObject)

        Raises:
            GitlabAuthenticationError: If authentication is not correct
            GitlabUpdateError: If the server cannot perform the request