@has_status(status='<STR_LIT>')<EOL><INDENT>@index<EOL>@mark_as_action<EOL>def edit(self, pid=None):<DEDENT>
pid = pid or self.pid<EOL>with db.session.begin_nested():<EOL><INDENT>before_record_update.send(<EOL>current_app._get_current_object(), record=self)<EOL>record_pid, record = self.fetch_published()<EOL>assert PIDStatus.REGISTERED == record_pid.status<EOL>assert record['<STR_LIT>'] == self['<STR_LIT>']<EOL>self.model.json = self._prepare_edit(record)<EOL>flag_modified(self.model, '<STR_LIT>')<EOL>db.session.merge(self.model)<EOL><DEDENT>after_record_update.send(<EOL>current_app._get_current_object(), record=self)<EOL>return self.__class__(self.model.json, model=self.model)<EOL>
Edit deposit.

        #. The signal :data:`invenio_records.signals.before_record_update`
           is sent before the edit execution.

        #. The following meta information are saved inside the deposit:

        .. code-block:: python

            deposit['_deposit']['pid'] = record.revision_id
            deposit['_deposit']['status'] = 'draft'
            deposit['$schema'] = deposit_schema_from_record_schema

        #. The signal :data:`invenio_records.signals.after_record_update` is
            sent after the edit execution.

        #. The deposit index is updated.

        Status required: `published`.

        .. note:: the process fails if the pid has status
            :attr:`invenio_pidstore.models.PIDStatus.REGISTERED`.

        :param pid: Force a pid object. (Default: ``None``)
        :returns: A new Deposit object.