Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Empty table causes runtime failure #76

Closed
mietek opened this issue Apr 24, 2014 · 0 comments
Closed

Empty table causes runtime failure #76

mietek opened this issue Apr 24, 2014 · 0 comments

Comments

@mietek
Copy link
Contributor

mietek commented Apr 24, 2014

An empty table can be viewed via /admin/${TABLE_NAME}view, but not via /${TABLE_NAME}s, as there is a runtime failure:

Traceback (most recent call last):
  File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/workers/sync.py", line 131, in handle_request
    respiter = self.wsgi(environ, resp.start_response)
  File "/app/.heroku/python/lib/python2.7/site-packages/flask/app.py", line 1836, in __call__
    return self.wsgi_app(environ, start_response)
  File "/app/.heroku/python/lib/python2.7/site-packages/werkzeug/contrib/fixers.py", line 144, in __call__
    return self.app(environ, start_response)
  File "/app/.heroku/python/lib/python2.7/site-packages/flask/app.py", line 1820, in wsgi_app
    response = self.make_response(self.handle_exception(e))
  File "/app/.heroku/python/lib/python2.7/site-packages/flask/app.py", line 1403, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/app/.heroku/python/lib/python2.7/site-packages/flask/app.py", line 1817, in wsgi_app

_dispatch_request()
  File "/app/.heroku/python/lib/python2.7/site-packages/flask/app.py", line 1477, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/app/.heroku/python/lib/python2.7/site-packages/flask/app.py", line 1381, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/app/.heroku/python/lib/python2.7/site-packages/flask/app.py", line 1475, in full_dispatch_request
    rv = self.dispatch_request()
  File "/app/.heroku/python/lib/python2.7/site-packages/flask/app.py", line 1461, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/app/.heroku/python/lib/python2.7/site-packages/sandman/decorators.py", line 27, in wrapped
    rv = f(*args, **kwargs)
  File "/app/.heroku/python/lib/python2.7/site-packages/sandman/sandman.py", line 493, in get_collection
    return collection_response(resources, start, stop)
  File "/app/.heroku/python/lib/python2.7/site-packages/sandman/sandman.py", line 279, in collection_response
    return _collection_html_response(resources, start, stop)
  File "/app/.heroku/python/lib/python2.7/site-packages/sandman/sandman.py", line 149, in _collection_html_response
    resources=resources[start:stop]))
  File "/app/.heroku/python/lib/python2.7/site-packages/flask/templating.py", line 128, in render_template
    context, ctx.app)
  File "/app/.heroku/python/lib/python2.7/site-packages/flask/templating.py", line 110, in _render
    rv = template.render(context)
  File "/app/.heroku/python/lib/python2.7/site-packages/jinja2/environment.py", line 969, in render
    return self.environment.handle_exception(exc_info, True)
  File "/app/.heroku/python/lib/python2.7/site-packages/jinja2/environment.py", line 742, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/app/.heroku/python/lib/python2.7/site-packages/sandman/templates/collection.html", line 1, in top-level template code
    {% extends "base.html" %}
  File "/app/.heroku/python/lib/python2.7/site-packages/sandman/templates/base.html", line 21, in top-level template code
    {% block content %}
  File "/app/.heroku/python/lib/python2.7/site-packages/sandman/templates/collection.html", line 5, in block "content"
    <h2>{{ resources[0].__tablename__ }}</h2>
  File "/app/.heroku/python/lib/python2.7/site-packages/jinja2/environment.py", line 401, in getattr
    return obj[attribute]
UndefinedError: list object has no element 0
sknat pushed a commit to sknat/sandman that referenced this issue Apr 30, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant