opened
lukasjuhrich
username_0
If a user has no room, the log endpoints `'all'` and `'hades'` fail with the following internal traceback:

```
172.22.0.1 - - [06/Dec/2017 22:52:01] "GET /user/10613/logs/hades?order=asc&offset=0&limit=20&_=1512598799624 HTTP/1.1" 500 -
Traceback (most recent call last):
  File "/usr/local/lib/python3.4/dist-packages/flask/app.py", line 1997, in __call__
    return self.wsgi_app(environ, start_response)
  File "/usr/local/lib/python3.4/dist-packages/werkzeug/contrib/profiler.py", line 103, in __call__
    p.runcall(runapp)
  File "/usr/lib/python3.4/cProfile.py", line 109, in runcall
    return func(*args, **kw)
  File "/usr/local/lib/python3.4/dist-packages/werkzeug/contrib/profiler.py", line 96, in runapp
    appiter = self._app(environ, catching_start_response)
  File "/usr/local/lib/python3.4/dist-packages/flask/app.py", line 1985, in wsgi_app
    response = self.handle_exception(e)
  File "/usr/local/lib/python3.4/dist-packages/flask/app.py", line 1540, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/local/lib/python3.4/dist-packages/flask/_compat.py", line 33, in reraise
    raise value
  File "/usr/local/lib/python3.4/dist-packages/flask/app.py", line 1982, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/local/lib/python3.4/dist-packages/flask/app.py", line 1614, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/local/lib/python3.4/dist-packages/flask/app.py", line 1517, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/local/lib/python3.4/dist-packages/flask/_compat.py", line 33, in reraise
    raise value
  File "/usr/local/lib/python3.4/dist-packages/flask/app.py", line 1612, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python3.4/dist-packages/flask/app.py", line 1598, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/pycroft/web/blueprints/user/__init__.py", line 217, in user_show_logs_json
    reverse=True)))
  File "/pycroft/web/blueprints/user/log.py", line 76, in formatted_user_hades_logs
    for interface, entry in get_user_hades_logs(user):
  File "/pycroft/web/blueprints/user/log.py", line 47, in get_user_hades_logs
    for patch_port in host.room.switch_patch_ports:
AttributeError: 'NoneType' object has no attribute 'switch_patch_ports'
```
Hades logs throw 500 if user has no room
issue
closed
lukasjuhrich
username_0
issue