Skip to content

Instantly share code, notes, and snippets.

@atroche
Created June 17, 2011 13:34
Show Gist options
  • Save atroche/1031424 to your computer and use it in GitHub Desktop.
Save atroche/1031424 to your computer and use it in GitHub Desktop.
changed_fields = document._get_changed_fields()
for field in changed_fields:
keys = field.split('.')
if (len(keys) == 3 and keys[0] == "comments"
and keys[2] in document.revision_fields):
comment_index = int(keys[1])
old_comment = old_message.comments[comment_index]
new_comment = document.comments[comment_index]
revision = Revision.create(old_comment, new_comment, [keys[2]],
user)
if revision.changes:
new_comment.revisions.append(revision)
new_comment.updated_at = datetime.datetime.now()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment