summaryrefslogtreecommitdiffstats
path: root/askbot/exceptions.py
blob: 12802e7edd72e95a7b4026398033b4b4308c57e4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
from django.core import exceptions
from django.utils.translation import ugettext as _

class DeploymentError(exceptions.ImproperlyConfigured):
    """raised when there is some error with deployment"""
    pass

class LoginRequired(exceptions.PermissionDenied):
    """raised when an operation required a logged 
    in user"""
    def __init__(self, msg = None):
        if msg is None:
            msg = _('Sorry, but anonymous visitors cannot access this function')
        super(LoginRequired, self).__init__(msg)

class InsufficientReputation(exceptions.PermissionDenied):
    """exception class to indicate that permission
    was denied due to insufficient reputation
    """
    pass

class AnswerAlreadyGiven(exceptions.PermissionDenied):
    """Raised when user attempts to post a second answer
    to the same question"""
    pass

class DuplicateCommand(exceptions.PermissionDenied):
    """exception class to indicate that something
    that can happen only once was attempted for the second time
    """
    pass

class EmailNotSent(exceptions.ImproperlyConfigured):
    """raised when email cannot be sent
    due to some mis-configurations on the server
    """
    pass

class QuestionHidden(exceptions.PermissionDenied):
    """raised when user cannot see deleted question
    """
    pass

class AnswerHidden(exceptions.PermissionDenied):
    """raised when user cannot see deleted answer
    """
    pass