From: Elrond <elrond+mediagoblin.org@samba-tng.org> Date: Fri, 1 Feb 2013 15:33:53 +0000 (+0100) Subject: Drop media_data_table property. X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=139c6c099fdbf139d2441db0c1a774081394a47d;p=mediagoblin.git 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(). --- 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')