diff options
author | Rodney Ewing <ewing.rj@gmail.com> | 2013-08-27 11:40:35 -0700 |
---|---|---|
committer | Rodney Ewing <ewing.rj@gmail.com> | 2013-09-19 08:12:09 -0700 |
commit | 7f9d3ca7c9e4934c3ee487a0f1d10e1b6525db71 (patch) | |
tree | 88d2fbf569bbf78fbbb54cfcef554b5a9d7b7ac7 /mediagoblin/db/models.py | |
parent | 755b6a86b6784ca5b1e8d427ce6e07442d16c974 (diff) | |
download | mediagoblin-7f9d3ca7c9e4934c3ee487a0f1d10e1b6525db71.tar.lz mediagoblin-7f9d3ca7c9e4934c3ee487a0f1d10e1b6525db71.tar.xz mediagoblin-7f9d3ca7c9e4934c3ee487a0f1d10e1b6525db71.zip |
need to use mutation tracking to detect changes in JSONEncoded types
Diffstat (limited to 'mediagoblin/db/models.py')
-rw-r--r-- | mediagoblin/db/models.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/mediagoblin/db/models.py b/mediagoblin/db/models.py index 809e4722..10558c5f 100644 --- a/mediagoblin/db/models.py +++ b/mediagoblin/db/models.py @@ -31,7 +31,8 @@ from sqlalchemy.ext.associationproxy import association_proxy from sqlalchemy.util import memoized_property -from mediagoblin.db.extratypes import PathTupleWithSlashes, JSONEncoded +from mediagoblin.db.extratypes import (PathTupleWithSlashes, JSONEncoded, + MutationDict) from mediagoblin.db.base import Base, DictReadAttrProxy from mediagoblin.db.mixin import UserMixin, MediaEntryMixin, \ MediaCommentMixin, CollectionMixin, CollectionItemMixin @@ -294,6 +295,7 @@ class MediaEntry(Base, MediaEntryMixin): file_metadata[key] = value media_file.file_metadata = file_metadata + media_file.save() @property def media_data(self): @@ -391,7 +393,7 @@ class MediaFile(Base): nullable=False) name_id = Column(SmallInteger, ForeignKey(FileKeynames.id), nullable=False) file_path = Column(PathTupleWithSlashes) - file_metadata = Column(JSONEncoded) + file_metadata = Column(MutationDict.as_mutable(JSONEncoded)) __table_args__ = ( PrimaryKeyConstraint('media_entry', 'name_id'), |