Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#5374 closed defect (fixed)

"Deathorize applications" causes server error after federation migrations

Reported by: ayleph Owned by:
Priority: blocker Milestone: 0.9.0
Component: programming Keywords: db, api, migrations, accesstoken
Cc: tsyesika Parent Tickets:


Clicking the "Deauthorize applications" link on current master causes a server error.

Error - <class 'sqlalchemy.exc.InvalidRequestError'>: Entity '<class 'mediagoblin.db.models.AccessToken'>' has no property 'user'
File '/path/to/mediagoblin/lib/python2.7/site-packages/paste/exceptions/', line 144 in __call__
  app_iter = self.application(environ, sr_checker)
File '/path/to/mediagoblin/mediagoblin/', line 342 in __call__
  return self.call_backend(environ, start_response)
File '/path/to/mediagoblin/lib/python2.7/site-packages/Werkzeug-0.10.1-py2.7.egg/werkzeug/', line 591 in __call__
  return, start_response)
File '/path/to/mediagoblin/mediagoblin/', line 276 in call_backend
  return self._finish_call_backend(request, environ, start_response)
File '/path/to/mediagoblin/mediagoblin/', line 318 in _finish_call_backend
  response = controller(request)
File '/path/to/mediagoblin/mediagoblin/', line 47 in wrapper
  return controller(request, *args, **kwargs)
File '/path/to/mediagoblin/mediagoblin/', line 74 in new_controller_func
  return controller(request, *args, **kwargs)
File '/path/to/mediagoblin/mediagoblin/edit/', line 296 in deauthorize_applications
  access_tokens = AccessToken.query.filter_by(
File 'build/bdist.linux-x86_64/egg/sqlalchemy/orm/', line 1256 in filter_by
File 'build/bdist.linux-x86_64/egg/sqlalchemy/orm/', line 1218 in _entity_descriptor
InvalidRequestError: Entity '<class 'mediagoblin.db.models.AccessToken'>' has no property 'user'


Change History (5)

comment:1 Changed 5 years ago by ayleph

mediagoblin/db/ was recently changed:

   class AccessToken(Base):
       token = Column(Unicode, nullable=False, primary_key=True)
       secret = Column(Unicode, nullable=False)
-      user = Column(Integer, ForeignKey(
+      actor = Column(Integer, ForeignKey(
       request_token = Column(Unicode, ForeignKey(RequestToken.token))

But mediagoblin/edit/ was not changed to match:

def deauthorize_applications(request):
    """ Deauthroize OAuth applications """
    access_tokens = AccessToken.query.filter_by(

comment:2 Changed 5 years ago by ayleph

Owner: ayleph deleted
Status: newreview

Patch below. Tested working on my instance. Requesting review.

From b628eb99cc246809bf0a381335b961d81accdb43 Mon Sep 17 00:00:00 2001
From: ayleph <>
Date: Thu, 17 Dec 2015 20:35:38 -0500
Subject: [PATCH] Fix issue 5374 Deauthorize Applications crashes

This patch fixes issue 5374 by querying the correct sql column for
access tokens.
 mediagoblin/edit/ | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mediagoblin/edit/ b/mediagoblin/edit/
index 3982820..00c6115 100644
--- a/mediagoblin/edit/
+++ b/mediagoblin/edit/
@@ -293,7 +293,7 @@ def deauthorize_applications(request):
                 _("Application has been deauthorized")

-    access_tokens = AccessToken.query.filter_by(
+    access_tokens = AccessToken.query.filter_by(
     applications = [(a.get_requesttoken, a) for a in access_tokens]

     return render_to_response(

comment:3 Changed 5 years ago by Jessica Tallon

This has been fixed f1db51e4.

comment:4 Changed 5 years ago by Jessica Tallon

Resolution: fixed
Status: reviewclosed

comment:5 Changed 5 years ago by Christopher Allan Webber


All 0.8.2 tickets are being rolled over to 0.9.0

Note: See TracTickets for help on using tickets.