Opened 8 years ago

Closed 8 years ago

#5469 closed defect (fixed)

InvalidRequestError on displaying an empty collection

Reported by: jscn Owned by:
Priority: major Milestone:
Component: programming Keywords:
Cc: Parent Tickets:

Description

When I create a collection but do not add any items to it, and then attempt to view said collection, an unhandled InvalidRequestError is raised:

2016-08-15 12:30:05,583 ERROR   [waitress] Exception when serving /u/jscn/collection/empty-collection/
Traceback (most recent call last):
  File "/home/jscn/work/code/mediagoblin/local/lib/python2.7/site-packages/waitress-1.0a2-py2.7.egg/waitress/channel.py", line 338, in service
    task.service()
  File "/home/jscn/work/code/mediagoblin/local/lib/python2.7/site-packages/waitress-1.0a2-py2.7.egg/waitress/task.py", line 169, in service
    self.execute()
  File "/home/jscn/work/code/mediagoblin/local/lib/python2.7/site-packages/waitress-1.0a2-py2.7.egg/waitress/task.py", line 399, in execute
    app_iter = self.channel.server.application(env, start_response)
  File "/home/jscn/work/code/mediagoblin/mediagoblin/app.py", line 342, in __call__
    return self.call_backend(environ, start_response)
  File "/home/jscn/work/code/mediagoblin/local/lib/python2.7/site-packages/Werkzeug-0.11.10-py2.7.egg/werkzeug/wsgi.py", line 599, in __call__
    return self.app(environ, start_response)
  File "/home/jscn/work/code/mediagoblin/mediagoblin/app.py", line 276, in call_backend
    return self._finish_call_backend(request, environ, start_response)
  File "/home/jscn/work/code/mediagoblin/mediagoblin/app.py", line 318, in _finish_call_backend
    response = controller(request)
  File "/home/jscn/work/code/mediagoblin/mediagoblin/decorators.py", line 47, in wrapper
    return controller(request, *args, **kwargs)
  File "/home/jscn/work/code/mediagoblin/mediagoblin/decorators.py", line 119, in wrapper
    return controller(request, *args, url_user=user, **kwargs)
  File "/home/jscn/work/code/mediagoblin/mediagoblin/decorators.py", line 170, in wrapper
    return controller(request, page=page, *args, **kwargs)
  File "/home/jscn/work/code/mediagoblin/mediagoblin/user_pages/views.py", line 395, in user_collection
    cursor = collection.get_collection_items()
  File "/home/jscn/work/code/mediagoblin/mediagoblin/db/models.py", line 1168, in get_collection_items
    return CollectionItem.query.join(MediaEntry).filter(
  File "/home/jscn/work/code/mediagoblin/local/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 1946, in join
    from_joinpoint=from_joinpoint)
  File "<string>", line 2, in _join
  File "/home/jscn/work/code/mediagoblin/local/lib/python2.7/site-packages/sqlalchemy/orm/base.py", line 201, in generate
    fn(self, *args[1:], **kw)
  File "/home/jscn/work/code/mediagoblin/local/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 2089, in _join
    outerjoin, create_aliases, prop)
  File "/home/jscn/work/code/mediagoblin/local/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 2157, in _join_left_to_right
    self._join_to_left(l_info, left, right, onclause, outerjoin)
  File "/home/jscn/work/code/mediagoblin/local/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 2285, in _join_to_left
    "Tried joining to %s, but got: %s" % (right, ae))
InvalidRequestError: Could not find a FROM clause to join from.  Tried joining to <class 'mediagoblin.db.models.MediaEntry'>, but got: Can't find any foreign key relationships between 'core__collection_items' and 'core__media_entries'.

Change History (2)

comment:1 by jscn, 8 years ago

Owner: set to jscn
Status: newin_progress

comment:2 by Boris Bobrov, 8 years ago

Owner: jscn removed
Resolution: fixed
Status: in_progressclosed

Fixed in 9d935dd

Note: See TracTickets for help on using tickets.