def revert(self):
with self.draft_context():<EOL><INDENT>draft = self.one(Q._uid == self._uid)<EOL><DEDENT>with self.published_context():<EOL><INDENT>published = self.one(Q._uid == self._uid)<EOL><DEDENT>for field, value in draft._document.items():<EOL><INDENT>if field in self._unpublished_fields:<EOL><INDENT>continue<EOL><DEDENT>setattr(draft, field, getattr(published, field))<EOL><DEDENT>draft.revision = published.revision<EOL>draft.update()<EOL>
Revert the document to currently published version