And remove some now useless methods.
authorElrond <elrond+mediagoblin.org@samba-tng.org>
Thu, 29 Mar 2012 21:05:34 +0000 (23:05 +0200)
committerElrond <elrond+mediagoblin.org@samba-tng.org>
Thu, 29 Mar 2012 21:23:57 +0000 (23:23 +0200)
mediagoblin/db/sql/models_v0.py

index 6dd231875a6b4919a64c6178d5ab6e5c817e48f5..5dd6b38b7abfb71868ee5058312d7f51b80f71bc 100644 (file)
@@ -28,7 +28,6 @@ from sqlalchemy import (
 from sqlalchemy.ext.declarative import declarative_base
 from sqlalchemy.orm import relationship, backref
 from sqlalchemy.orm.collections import attribute_mapped_collection
-from sqlalchemy.sql.expression import desc
 from sqlalchemy.ext.associationproxy import association_proxy
 from sqlalchemy.util import memoized_property
 
@@ -110,41 +109,6 @@ class MediaEntry(Base_v0):
         cascade="all, delete-orphan"
         )
 
-    def get_comments(self, ascending=False):
-        order_col = MediaComment.created
-        if not ascending:
-            order_col = desc(order_col)
-        return MediaComment.query.filter_by(
-            media_entry=self.id).order_by(order_col)
-
-    def url_to_prev(self, urlgen):
-        """get the next 'newer' entry by this user"""
-        media = MediaEntry.query.filter(
-            (MediaEntry.uploader == self.uploader)
-            & (MediaEntry.state == 'processed')
-            & (MediaEntry.id > self.id)).order_by(MediaEntry.id).first()
-
-        if media is not None:
-            return media.url_for_self(urlgen)
-
-    def url_to_next(self, urlgen):
-        """get the next 'older' entry by this user"""
-        media = MediaEntry.query.filter(
-            (MediaEntry.uploader == self.uploader)
-            & (MediaEntry.state == 'processed')
-            & (MediaEntry.id < self.id)).order_by(desc(MediaEntry.id)).first()
-
-        if media is not None:
-            return media.url_for_self(urlgen)
-
-    #@memoized_property
-    @property
-    def media_data(self):
-        session = Session()
-
-        return session.query(self.media_data_table).filter_by(
-            media_entry=self.id).first()
-
     def media_data_init(self, **kwargs):
         """
         Initialize or update the contents of a media entry's media_data row