From 139c6c099fdbf139d2441db0c1a774081394a47d Mon Sep 17 00:00:00 2001 From: Elrond Date: Fri, 1 Feb 2013 16:33:53 +0100 Subject: [PATCH] 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(). --- mediagoblin/db/models.py | 9 +++------ 1 file 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: @@ -223,10 +224,6 @@ class MediaEntry(Base, MediaEntryMixin): for field, value in kwargs.iteritems(): 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')