accept_all_revisions method

accept_all_revisions()

Accepts all tracked changes in the document.

def accept_all_revisions(self):
    ...

Remarks

This method is a shortcut for RevisionCollection.accept_all().

Examples

Shows how to accept all tracking changes in the document.

doc = aw.Document()
builder = aw.DocumentBuilder(doc=doc)
# Edit the document while tracking changes to create a few revisions.
doc.start_track_revisions(author='John Doe')
builder.write('Hello world! ')
builder.write('Hello again! ')
builder.write('This is another revision.')
doc.stop_track_revisions()
self.assertEqual(3, doc.revisions.count)
# We can iterate through every revision and accept/reject it as a part of our document.
# If we know we wish to accept every revision, we can do it more straightforwardly so by calling this method.
doc.accept_all_revisions()
self.assertEqual(0, doc.revisions.count)
self.assertEqual('Hello world! Hello again! This is another revision.', doc.get_text().strip())

See Also