VirtualMailManager/Exceptions.py
author Pascal Volk <neverseen@users.sourceforge.net>
Thu, 20 Aug 2009 03:28:26 +0000
changeset 121 7ccc05774118
parent 102 485d3f7d6981
child 138 617f27715b01
permissions -rw-r--r--
Converted to new-style class, added __slots__, updated queries. Use the _uid attribute in queries whenever it is possible.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
     1
# -*- coding: UTF-8 -*-
102
485d3f7d6981 Removed svn keywords, more POSIX compliant shell scripts
Pascal Volk <neverseen@users.sourceforge.net>
parents: 76
diff changeset
     2
# Copyright (c) 2007 - 2009, VEB IT
0
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
     3
# See COPYING for distribution information.
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
     4
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
     5
"""Exception classes for Virtual Mail Manager"""
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
     6
102
485d3f7d6981 Removed svn keywords, more POSIX compliant shell scripts
Pascal Volk <neverseen@users.sourceforge.net>
parents: 76
diff changeset
     7
from constants.VERSION import *
0
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
     8
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
     9
class VMMException(Exception):
32
ceb700bc4a80 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 8
diff changeset
    10
    """Exception class for VirtualMailManager exceptions"""
48
0d5f58f8b8f5 * 'VirtualMailManager/Exceptions.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 47
diff changeset
    11
    def __init__(self, msg, code):
0
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    12
        Exception.__init__(self, msg)
48
0d5f58f8b8f5 * 'VirtualMailManager/Exceptions.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 47
diff changeset
    13
        self._code = int(code)
61
d85482575349 * 'VirtualMailManager/Exceptions.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 55
diff changeset
    14
        ### for older python versions, like py 2.4.4 on OpenBSD 4.2
d85482575349 * 'VirtualMailManager/Exceptions.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 55
diff changeset
    15
        if not hasattr(self, 'message'):
d85482575349 * 'VirtualMailManager/Exceptions.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 55
diff changeset
    16
            self.message = msg
0
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    17
48
0d5f58f8b8f5 * 'VirtualMailManager/Exceptions.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 47
diff changeset
    18
    def msg(self):
0d5f58f8b8f5 * 'VirtualMailManager/Exceptions.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 47
diff changeset
    19
        """Returns the exception message."""
0d5f58f8b8f5 * 'VirtualMailManager/Exceptions.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 47
diff changeset
    20
        return self.message
0d5f58f8b8f5 * 'VirtualMailManager/Exceptions.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 47
diff changeset
    21
0d5f58f8b8f5 * 'VirtualMailManager/Exceptions.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 47
diff changeset
    22
    def code(self):
0d5f58f8b8f5 * 'VirtualMailManager/Exceptions.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 47
diff changeset
    23
        """Returns the numeric exception error code."""
0d5f58f8b8f5 * 'VirtualMailManager/Exceptions.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 47
diff changeset
    24
        return self._code
0
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    25
48
0d5f58f8b8f5 * 'VirtualMailManager/Exceptions.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 47
diff changeset
    26
class VMMConfigException(VMMException):
0d5f58f8b8f5 * 'VirtualMailManager/Exceptions.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 47
diff changeset
    27
    """Exception class for Configurtion exceptions"""
0d5f58f8b8f5 * 'VirtualMailManager/Exceptions.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 47
diff changeset
    28
    def __init__(self, msg, code):
0d5f58f8b8f5 * 'VirtualMailManager/Exceptions.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 47
diff changeset
    29
        VMMException.__init__(self, msg, code)
0
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    30
48
0d5f58f8b8f5 * 'VirtualMailManager/Exceptions.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 47
diff changeset
    31
class VMMPermException(VMMException):
0d5f58f8b8f5 * 'VirtualMailManager/Exceptions.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 47
diff changeset
    32
    """Exception class for permissions exceptions"""
0d5f58f8b8f5 * 'VirtualMailManager/Exceptions.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 47
diff changeset
    33
    def __init__(self, msg, code):
0d5f58f8b8f5 * 'VirtualMailManager/Exceptions.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 47
diff changeset
    34
        VMMException.__init__(self, msg, code)
0d5f58f8b8f5 * 'VirtualMailManager/Exceptions.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 47
diff changeset
    35
0d5f58f8b8f5 * 'VirtualMailManager/Exceptions.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 47
diff changeset
    36
class VMMNotRootException(VMMException):
32
ceb700bc4a80 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 8
diff changeset
    37
    """Exception class for non-root exceptions"""
48
0d5f58f8b8f5 * 'VirtualMailManager/Exceptions.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 47
diff changeset
    38
    def __init__(self, msg, code):
0d5f58f8b8f5 * 'VirtualMailManager/Exceptions.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 47
diff changeset
    39
        VMMException.__init__(self, msg, code)
0
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    40
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    41
class VMMDomainException(VMMException):
32
ceb700bc4a80 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 8
diff changeset
    42
    """Exception class for Domain exceptions"""
48
0d5f58f8b8f5 * 'VirtualMailManager/Exceptions.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 47
diff changeset
    43
    def __init__(self, msg, code):
0d5f58f8b8f5 * 'VirtualMailManager/Exceptions.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 47
diff changeset
    44
        VMMException.__init__(self, msg, code)
0
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    45
55
15c873f94ba6 * 'VirtualMailManager/Exceptions.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 48
diff changeset
    46
class VMMAliasDomainException(VMMException):
15c873f94ba6 * 'VirtualMailManager/Exceptions.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 48
diff changeset
    47
    """Exception class for AliasDomain exceptions"""
48
0d5f58f8b8f5 * 'VirtualMailManager/Exceptions.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 47
diff changeset
    48
    def __init__(self, msg, code):
0d5f58f8b8f5 * 'VirtualMailManager/Exceptions.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 47
diff changeset
    49
        VMMException.__init__(self, msg, code)
47
191d5a5adc4a * Removed gettext import and setup in VirtualMailManager/:
Pascal Volk <neverseen@users.sourceforge.net>
parents: 32
diff changeset
    50
0
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    51
class VMMAccountException(VMMException):
32
ceb700bc4a80 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 8
diff changeset
    52
    """Exception class for Account exceptions"""
48
0d5f58f8b8f5 * 'VirtualMailManager/Exceptions.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 47
diff changeset
    53
    def __init__(self, msg, code):
0d5f58f8b8f5 * 'VirtualMailManager/Exceptions.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 47
diff changeset
    54
        VMMException.__init__(self, msg, code)
0
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    55
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    56
class VMMAliasException(VMMException):
8
7e3ce56f49e6 * 'create_tables.pgsql'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 4
diff changeset
    57
    """Exception class for Alias exceptions"""
48
0d5f58f8b8f5 * 'VirtualMailManager/Exceptions.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 47
diff changeset
    58
    def __init__(self, msg, code):
0d5f58f8b8f5 * 'VirtualMailManager/Exceptions.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 47
diff changeset
    59
        VMMException.__init__(self, msg, code)
8
7e3ce56f49e6 * 'create_tables.pgsql'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 4
diff changeset
    60
76
14c0a092d7d2 * 'VirtualMailManager/EmailAddress.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 61
diff changeset
    61
class VMMEmailAddressException(VMMException):
14c0a092d7d2 * 'VirtualMailManager/EmailAddress.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 61
diff changeset
    62
    """Exception class for EmailAddress exceptions"""
14c0a092d7d2 * 'VirtualMailManager/EmailAddress.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 61
diff changeset
    63
    def __init__(self, msg, code):
14c0a092d7d2 * 'VirtualMailManager/EmailAddress.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 61
diff changeset
    64
        VMMException.__init__(self, msg, code)
14c0a092d7d2 * 'VirtualMailManager/EmailAddress.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 61
diff changeset
    65
8
7e3ce56f49e6 * 'create_tables.pgsql'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 4
diff changeset
    66
class VMMMailLocationException(VMMException):
7e3ce56f49e6 * 'create_tables.pgsql'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 4
diff changeset
    67
    """Exception class for MailLocation exceptions"""
48
0d5f58f8b8f5 * 'VirtualMailManager/Exceptions.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 47
diff changeset
    68
    def __init__(self, msg, code):
0d5f58f8b8f5 * 'VirtualMailManager/Exceptions.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 47
diff changeset
    69
        VMMException.__init__(self, msg, code)
8
7e3ce56f49e6 * 'create_tables.pgsql'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 4
diff changeset
    70
76
14c0a092d7d2 * 'VirtualMailManager/EmailAddress.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 61
diff changeset
    71
class VMMRelocatedException(VMMException):
14c0a092d7d2 * 'VirtualMailManager/EmailAddress.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 61
diff changeset
    72
    """Exception class for Relocated exceptions"""
14c0a092d7d2 * 'VirtualMailManager/EmailAddress.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 61
diff changeset
    73
    def __init__(self, msg, code):
14c0a092d7d2 * 'VirtualMailManager/EmailAddress.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 61
diff changeset
    74
        VMMException.__init__(self, msg, code)
14c0a092d7d2 * 'VirtualMailManager/EmailAddress.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 61
diff changeset
    75
8
7e3ce56f49e6 * 'create_tables.pgsql'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 4
diff changeset
    76
class VMMTransportException(VMMException):
7e3ce56f49e6 * 'create_tables.pgsql'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 4
diff changeset
    77
    """Exception class for Transport exceptions"""
48
0d5f58f8b8f5 * 'VirtualMailManager/Exceptions.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 47
diff changeset
    78
    def __init__(self, msg, code):
0d5f58f8b8f5 * 'VirtualMailManager/Exceptions.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 47
diff changeset
    79
        VMMException.__init__(self, msg, code)