This was a very important update where I fixed a few small but fatal bugs in my
authortilly-Q <nattilypigeonfowl@gmail.com>
Thu, 3 Oct 2013 21:07:11 +0000 (17:07 -0400)
committertilly-Q <nattilypigeonfowl@gmail.com>
Thu, 3 Oct 2013 21:07:11 +0000 (17:07 -0400)
code. I had removed the import of Privilege in mediagoblin.db.migrations, and
this was still necessary and was causing errors. I also made it so that media
deletion by moderators, through reports, actually fully deleted the media,
rather than just deleting the database representation of the media. Lastly, I
fixed a bug in migration that caused a fatal error on login because the UserBan
user_id column was improperly named in it's creation by migration.

mediagoblin/db/migrations.py
mediagoblin/moderation/tools.py

index 6e644c3a8db56020cd84d9f4afd8a8d9980d2305..7011d842b28f961b05796b10e3d1f15d12fef1c8 100644 (file)
@@ -28,8 +28,8 @@ from migrate.changeset.constraint import UniqueConstraint
 
 from mediagoblin.db.extratypes import JSONEncoded
 from mediagoblin.db.migration_tools import RegisterMigration, inspect_table
-from mediagoblin.db.models import (MediaEntry, Collection, User,
-                                   MediaComment, Privilege)
+from mediagoblin.db.models import (MediaEntry, Collection, MediaComment, User, 
+        Privilege)
 
 MIGRATIONS = {}
 
@@ -506,7 +506,7 @@ class MediaReport_v0(ReportBase_v0):
 
 class UserBan_v0(declarative_base()):
     __tablename__ = 'core__user_bans'
-    user_id = Column('id',Integer, ForeignKey(User.id), nullable=False,
+    user_id = Column(Integer, ForeignKey(User.id), nullable=False,
                                          primary_key=True)
     expiration_date = Column(Date)
     reason = Column(UnicodeText, nullable=False)
index f519e5f30af225d3aea337106fe380ab401a65d9..e0337536574b914c9725a86e782f5564fb061d94 100644 (file)
@@ -73,7 +73,7 @@ def take_punitive_actions(request, form, report, user):
     elif u'delete' in form.action_to_resolve.data and \
         report.is_media_entry_report():
             deleted_media = report.media_entry
-            Session.delete(deleted_media)
+            deleted_media.delete()
             form.resolution_content.data += \
                 u"\n{mod} deleted the media entry.".format(
                     mod=request.user.username)