File: root.py

package info (click to toggle)
python-wsme 0.6-3
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 956 kB
  • ctags: 1,831
  • sloc: python: 8,452; makefile: 138
file content (21 lines) | stat: -rw-r--r-- 549 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
from pecan import expose
from webob.exc import status_map
from .ws import AuthorsController
from wsmeext.pecan import wsexpose


class RootController(object):
    authors = AuthorsController()

    @expose('error.html')
    def error(self, status):
        try:
            status = int(status)
        except ValueError:  # pragma: no cover
            status = 500
        message = getattr(status_map.get(status), 'explanation', '')
        return dict(status=status, message=message)

    @wsexpose()
    def divide_by_zero(self):
        1 / 0