Created
June 17, 2011 13:34
-
-
Save atroche/1031424 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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