File: root.py

package info (click to toggle)
python-wsme 0.12.1-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 616 kB
  • sloc: python: 6,064; makefile: 27; javascript: 8
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