aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorElrond <elrond+mediagoblin.org@samba-tng.org>2013-02-01 16:33:53 +0100
committerElrond <elrond+mediagoblin.org@samba-tng.org>2013-02-01 22:02:35 +0100
commit139c6c099fdbf139d2441db0c1a774081394a47d (patch)
treee527ec7067292287bf683005714cd5314996c6b8
parent1f268deda4af36d9547effd890c11e6005d4877f (diff)
downloadmediagoblin-139c6c099fdbf139d2441db0c1a774081394a47d.tar.lz
mediagoblin-139c6c099fdbf139d2441db0c1a774081394a47d.tar.xz
mediagoblin-139c6c099fdbf139d2441db0c1a774081394a47d.zip
Drop media_data_table property.
Only when creating a new media_data row, we need the table. So load that locally in media_data_init().
-rw-r--r--mediagoblin/db/models.py9
1 files changed, 3 insertions, 6 deletions
diff --git a/mediagoblin/db/models.py b/mediagoblin/db/models.py
index bdd957dd..c9bc3c11 100644
--- a/mediagoblin/db/models.py
+++ b/mediagoblin/db/models.py
@@ -213,9 +213,10 @@ class MediaEntry(Base, MediaEntryMixin):
media_data = self.media_data
if media_data is None:
+ # Get the correct table:
+ table = import_component(self.media_type + '.models:DATA_MODEL')
# No media data, so actually add a new one
- media_data = self.media_data_table(
- **kwargs)
+ media_data = table(**kwargs)
# Get the relationship set up.
media_data.get_media_entry = self
else:
@@ -224,10 +225,6 @@ class MediaEntry(Base, MediaEntryMixin):
setattr(media_data, field, value)
@memoized_property
- def media_data_table(self):
- return import_component(self.media_type + '.models:DATA_MODEL')
-
- @memoized_property
def media_data_ref(self):
return import_component(self.media_type + '.models:BACKREF_NAME')