Skip to content

Commit

Permalink
Integrate Zope 3-based exception views. Patch by Sidnei, integration
Browse files Browse the repository at this point in the history
work done for Infrae.
  • Loading branch information
faassen committed Jul 5, 2007
1 parent d965bcc commit f5a7ccf
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
13 changes: 9 additions & 4 deletions __init__.py
Expand Up @@ -20,17 +20,22 @@

from unauthorized import Unauthorized

from zope.interface import implements
from zope.interface.common.interfaces import IException
from zope.publisher.interfaces import INotFound
from zope.security.interfaces import IForbidden

class BadRequest(Exception):
pass
implements(IException)

class InternalError(Exception):
pass
implements(IException)

class NotFound(Exception):
pass
implements(INotFound)

class Forbidden(Exception):
pass
implements(IForbidden)

class MethodNotAllowed(Exception):
pass
Expand Down
6 changes: 5 additions & 1 deletion unauthorized.py
Expand Up @@ -15,9 +15,13 @@
"""

from types import StringType
from zope.interface import implements
from zope.security.interfaces import IUnauthorized

class Unauthorized(Exception):
"""Some user wasn't allowed to access a resource"""
"""Some user wasn't allowed to access a resource
"""
implements(IUnauthorized)

def __init__(self, message=None, value=None, needed=None, name=None, **kw):
"""Possible signatures:
Expand Down

0 comments on commit f5a7ccf

Please sign in to comment.