def new_revision(self, *fields):
<EOL>if not self._id:<EOL><INDENT>assert g.get('<STR_LIT>'),'<STR_LIT>'<EOL><DEDENT>else:<EOL><INDENT>with self.draft_context():<EOL><INDENT>assert self.count(Q._id == self._id) == <NUM_LIT:1>,'<STR_LIT>'<EOL><DEDENT><DEDENT>if len(fields) > <NUM_LIT:0>:<EOL><INDENT>fields.append('<STR_LIT>')<EOL><DEDENT>self.revision = datetime.now()<EOL>self.upsert(*fields)<EOL>
Save a new revision of the document