From b4997540dcc7b75441e9b10ee6dcac32cc2708be Mon Sep 17 00:00:00 2001 From: Jessica Tallon Date: Mon, 24 Aug 2015 18:28:41 +0200 Subject: Fix some unit tests and bugs This fixes a lot of the issues with the LocalUser changes that were merged recently. There was a problem where the attributes of LocalUser were not being eagerly loaded and because the Session was detached an exception was being raised when they were accessed. This also fixes some typo's which were introduced. Finally this adds a temporary fix for a potential SQLAlchemy bug, this is a bug where doing: User.query.filter(LocalUser.username == "some_username").first() does NOT yeild a user with the username "some_username" but all users on the site. The temp fix is to just query the LocalUser, this should be resolved when bug is confirmed and fixed upstream. --- mediagoblin/plugins/archivalook/tools.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mediagoblin/plugins/archivalook') diff --git a/mediagoblin/plugins/archivalook/tools.py b/mediagoblin/plugins/archivalook/tools.py index e806e4ee..fb5673e1 100644 --- a/mediagoblin/plugins/archivalook/tools.py +++ b/mediagoblin/plugins/archivalook/tools.py @@ -34,7 +34,7 @@ def get_media_entry_from_uploader_slug(uploader_username, slug): :returns media A MediaEntry object or None if no entry matches the specifications. """ - uploader = User.query.filter( + uploader = LocalUser.query.filter( LocalUser.username==uploader_username ).first() media = MediaEntry.query.filter( -- cgit v1.2.3