VirtualMailManager/Exceptions.py
author Pascal Volk <neverseen@users.sourceforge.net>
Thu, 25 Feb 2010 17:56:08 +0000
branchv0.6.x
changeset 215 33f727efa7c4
parent 214 84e6e898e6c5
permissions -rw-r--r--
PEP-8-ified the work of the last days. Renamed methods in class Alias: addDestination() -> add_destination() delDestination() -> del_destination() getDestinations() -> get_destinations() Renamed methods in class Relocated: setDestination() -> set_destination() getInfo() -> get_info() Renamed VMM/constants/VERSION.py -> VMM/constants/version.py Adjusted relevant parts of the documentation.
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 -*-
162
0ac9ef587769 Updated copyright notices to include the year 2010.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 138
diff changeset
     2
# Copyright (c) 2007 - 2010, Pascal Volk
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
214
84e6e898e6c5 VMM/Exceptions: use the inherited CTor in all VMM*Exception classes.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 162
diff changeset
     5
"""
84e6e898e6c5 VMM/Exceptions: use the inherited CTor in all VMM*Exception classes.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 162
diff changeset
     6
    VirtualMailManager.Exceptions
84e6e898e6c5 VMM/Exceptions: use the inherited CTor in all VMM*Exception classes.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 162
diff changeset
     7
84e6e898e6c5 VMM/Exceptions: use the inherited CTor in all VMM*Exception classes.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 162
diff changeset
     8
    VMM's Exception classes
84e6e898e6c5 VMM/Exceptions: use the inherited CTor in all VMM*Exception classes.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 162
diff changeset
     9
"""
84e6e898e6c5 VMM/Exceptions: use the inherited CTor in all VMM*Exception classes.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 162
diff changeset
    10
0
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    11
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    12
class VMMException(Exception):
214
84e6e898e6c5 VMM/Exceptions: use the inherited CTor in all VMM*Exception classes.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 162
diff changeset
    13
    """Exception base class for VirtualMailManager exceptions"""
84e6e898e6c5 VMM/Exceptions: use the inherited CTor in all VMM*Exception classes.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 162
diff changeset
    14
48
0d5f58f8b8f5 * 'VirtualMailManager/Exceptions.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 47
diff changeset
    15
    def __init__(self, msg, code):
0
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    16
        Exception.__init__(self, msg)
48
0d5f58f8b8f5 * 'VirtualMailManager/Exceptions.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 47
diff changeset
    17
        self._code = int(code)
61
d85482575349 * 'VirtualMailManager/Exceptions.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 55
diff changeset
    18
        ### 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
    19
        if not hasattr(self, 'message'):
d85482575349 * 'VirtualMailManager/Exceptions.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 55
diff changeset
    20
            self.message = msg
0
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    21
48
0d5f58f8b8f5 * 'VirtualMailManager/Exceptions.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 47
diff changeset
    22
    def msg(self):
0d5f58f8b8f5 * 'VirtualMailManager/Exceptions.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 47
diff changeset
    23
        """Returns the exception message."""
0d5f58f8b8f5 * 'VirtualMailManager/Exceptions.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 47
diff changeset
    24
        return self.message
0d5f58f8b8f5 * 'VirtualMailManager/Exceptions.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 47
diff changeset
    25
0d5f58f8b8f5 * 'VirtualMailManager/Exceptions.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 47
diff changeset
    26
    def code(self):
0d5f58f8b8f5 * 'VirtualMailManager/Exceptions.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 47
diff changeset
    27
        """Returns the numeric exception error code."""
0d5f58f8b8f5 * 'VirtualMailManager/Exceptions.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 47
diff changeset
    28
        return self._code
0
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    29
214
84e6e898e6c5 VMM/Exceptions: use the inherited CTor in all VMM*Exception classes.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 162
diff changeset
    30
48
0d5f58f8b8f5 * 'VirtualMailManager/Exceptions.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 47
diff changeset
    31
class VMMConfigException(VMMException):
214
84e6e898e6c5 VMM/Exceptions: use the inherited CTor in all VMM*Exception classes.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 162
diff changeset
    32
    """Exception class for configuration exceptions"""
84e6e898e6c5 VMM/Exceptions: use the inherited CTor in all VMM*Exception classes.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 162
diff changeset
    33
    pass
84e6e898e6c5 VMM/Exceptions: use the inherited CTor in all VMM*Exception classes.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 162
diff changeset
    34
0
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    35
48
0d5f58f8b8f5 * 'VirtualMailManager/Exceptions.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 47
diff changeset
    36
class VMMPermException(VMMException):
0d5f58f8b8f5 * 'VirtualMailManager/Exceptions.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 47
diff changeset
    37
    """Exception class for permissions exceptions"""
214
84e6e898e6c5 VMM/Exceptions: use the inherited CTor in all VMM*Exception classes.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 162
diff changeset
    38
    pass
84e6e898e6c5 VMM/Exceptions: use the inherited CTor in all VMM*Exception classes.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 162
diff changeset
    39
48
0d5f58f8b8f5 * 'VirtualMailManager/Exceptions.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 47
diff changeset
    40
0d5f58f8b8f5 * 'VirtualMailManager/Exceptions.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 47
diff changeset
    41
class VMMNotRootException(VMMException):
32
ceb700bc4a80 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 8
diff changeset
    42
    """Exception class for non-root exceptions"""
214
84e6e898e6c5 VMM/Exceptions: use the inherited CTor in all VMM*Exception classes.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 162
diff changeset
    43
    pass
84e6e898e6c5 VMM/Exceptions: use the inherited CTor in all VMM*Exception classes.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 162
diff changeset
    44
0
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    45
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    46
class VMMDomainException(VMMException):
32
ceb700bc4a80 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 8
diff changeset
    47
    """Exception class for Domain exceptions"""
214
84e6e898e6c5 VMM/Exceptions: use the inherited CTor in all VMM*Exception classes.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 162
diff changeset
    48
    pass
84e6e898e6c5 VMM/Exceptions: use the inherited CTor in all VMM*Exception classes.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 162
diff changeset
    49
0
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    50
55
15c873f94ba6 * 'VirtualMailManager/Exceptions.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 48
diff changeset
    51
class VMMAliasDomainException(VMMException):
15c873f94ba6 * 'VirtualMailManager/Exceptions.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 48
diff changeset
    52
    """Exception class for AliasDomain exceptions"""
214
84e6e898e6c5 VMM/Exceptions: use the inherited CTor in all VMM*Exception classes.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 162
diff changeset
    53
    pass
84e6e898e6c5 VMM/Exceptions: use the inherited CTor in all VMM*Exception classes.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 162
diff changeset
    54
47
191d5a5adc4a * Removed gettext import and setup in VirtualMailManager/:
Pascal Volk <neverseen@users.sourceforge.net>
parents: 32
diff changeset
    55
0
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    56
class VMMAccountException(VMMException):
32
ceb700bc4a80 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 8
diff changeset
    57
    """Exception class for Account exceptions"""
214
84e6e898e6c5 VMM/Exceptions: use the inherited CTor in all VMM*Exception classes.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 162
diff changeset
    58
    pass
84e6e898e6c5 VMM/Exceptions: use the inherited CTor in all VMM*Exception classes.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 162
diff changeset
    59
0
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    60
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    61
class VMMAliasException(VMMException):
8
7e3ce56f49e6 * 'create_tables.pgsql'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 4
diff changeset
    62
    """Exception class for Alias exceptions"""
214
84e6e898e6c5 VMM/Exceptions: use the inherited CTor in all VMM*Exception classes.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 162
diff changeset
    63
    pass
84e6e898e6c5 VMM/Exceptions: use the inherited CTor in all VMM*Exception classes.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 162
diff changeset
    64
8
7e3ce56f49e6 * 'create_tables.pgsql'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 4
diff changeset
    65
76
14c0a092d7d2 * 'VirtualMailManager/EmailAddress.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 61
diff changeset
    66
class VMMEmailAddressException(VMMException):
14c0a092d7d2 * 'VirtualMailManager/EmailAddress.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 61
diff changeset
    67
    """Exception class for EmailAddress exceptions"""
214
84e6e898e6c5 VMM/Exceptions: use the inherited CTor in all VMM*Exception classes.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 162
diff changeset
    68
    pass
84e6e898e6c5 VMM/Exceptions: use the inherited CTor in all VMM*Exception classes.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 162
diff changeset
    69
76
14c0a092d7d2 * 'VirtualMailManager/EmailAddress.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 61
diff changeset
    70
8
7e3ce56f49e6 * 'create_tables.pgsql'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 4
diff changeset
    71
class VMMMailLocationException(VMMException):
7e3ce56f49e6 * 'create_tables.pgsql'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 4
diff changeset
    72
    """Exception class for MailLocation exceptions"""
214
84e6e898e6c5 VMM/Exceptions: use the inherited CTor in all VMM*Exception classes.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 162
diff changeset
    73
    pass
84e6e898e6c5 VMM/Exceptions: use the inherited CTor in all VMM*Exception classes.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 162
diff changeset
    74
8
7e3ce56f49e6 * 'create_tables.pgsql'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 4
diff changeset
    75
76
14c0a092d7d2 * 'VirtualMailManager/EmailAddress.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 61
diff changeset
    76
class VMMRelocatedException(VMMException):
14c0a092d7d2 * 'VirtualMailManager/EmailAddress.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 61
diff changeset
    77
    """Exception class for Relocated exceptions"""
214
84e6e898e6c5 VMM/Exceptions: use the inherited CTor in all VMM*Exception classes.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 162
diff changeset
    78
    pass
84e6e898e6c5 VMM/Exceptions: use the inherited CTor in all VMM*Exception classes.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 162
diff changeset
    79
76
14c0a092d7d2 * 'VirtualMailManager/EmailAddress.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 61
diff changeset
    80
8
7e3ce56f49e6 * 'create_tables.pgsql'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 4
diff changeset
    81
class VMMTransportException(VMMException):
7e3ce56f49e6 * 'create_tables.pgsql'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 4
diff changeset
    82
    """Exception class for Transport exceptions"""
214
84e6e898e6c5 VMM/Exceptions: use the inherited CTor in all VMM*Exception classes.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 162
diff changeset
    83
    pass