VirtualMailManager/Exceptions.py
author Pascal Volk <neverseen@users.sourceforge.net>
Tue, 19 Aug 2008 02:40:43 +0000
changeset 48 0d5f58f8b8f5
parent 47 191d5a5adc4a
child 55 15c873f94ba6
permissions -rw-r--r--
* 'VirtualMailManager/Exceptions.py' - Rewrote class VMMException and all derived VMM*Exception classes. Affected files in VirtualMailManager/: + '../vmm' + 'Account.py' + 'Alias.py' + 'Config.py' + 'Domain.py' + 'MailLocation.py' + 'Transport.py' + 'VirtualMailManager.py' * 'VirtualMailManager/Config.py' - Some code cleanups/fixes in: + VMMConfig.load() + VMMConfig.configure() * 'VirtualMailManager/DomainAlias.py' - Added to repository * 'VirtualMailManager/VirtualMailManager.py' - Some code cleanups in: + VirtualMailManager.__chkCfgFile() + VirtualMailManager.__getFileMode() removed + VirtualMailManager.configure() * 'vmm' - Rewrote: + usage() + configure() + __main__ - Implemented show_version() * 'po/de.po' * 'po/vmm.pot' - updated
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
#!/usr/bin/env python
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
     2
# -*- coding: UTF-8 -*-
8
7e3ce56f49e6 * 'create_tables.pgsql'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 4
diff changeset
     3
# Copyright 2007-2008 VEB IT
0
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
     4
# See COPYING for distribution information.
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
     5
# $Id$
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
     6
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
     7
"""Exception classes for Virtual Mail Manager"""
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
     8
4
f3c30b7421b9 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 2
diff changeset
     9
from constants.VERSION import VERSION
f3c30b7421b9 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 2
diff changeset
    10
0
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    11
__author__ = 'Pascal Volk <p.volk@veb-it.de>'
4
f3c30b7421b9 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 2
diff changeset
    12
__version__ = VERSION
f3c30b7421b9 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 2
diff changeset
    13
__revision__ = 'rev '+'$Rev$'.split()[1]
0
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    14
__date__ = '$Date$'.split()[1]
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    15
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    16
class VMMException(Exception):
32
ceb700bc4a80 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 8
diff changeset
    17
    """Exception class for VirtualMailManager exceptions"""
48
0d5f58f8b8f5 * 'VirtualMailManager/Exceptions.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 47
diff changeset
    18
    def __init__(self, msg, code):
0
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    19
        Exception.__init__(self, msg)
48
0d5f58f8b8f5 * 'VirtualMailManager/Exceptions.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 47
diff changeset
    20
        self._code = int(code)
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
48
0d5f58f8b8f5 * 'VirtualMailManager/Exceptions.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 47
diff changeset
    30
class VMMConfigException(VMMException):
0d5f58f8b8f5 * 'VirtualMailManager/Exceptions.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 47
diff changeset
    31
    """Exception class for Configurtion exceptions"""
0d5f58f8b8f5 * 'VirtualMailManager/Exceptions.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 47
diff changeset
    32
    def __init__(self, msg, code):
0d5f58f8b8f5 * 'VirtualMailManager/Exceptions.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 47
diff changeset
    33
        VMMException.__init__(self, msg, code)
0
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    34
48
0d5f58f8b8f5 * 'VirtualMailManager/Exceptions.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 47
diff changeset
    35
class VMMPermException(VMMException):
0d5f58f8b8f5 * 'VirtualMailManager/Exceptions.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 47
diff changeset
    36
    """Exception class for permissions exceptions"""
0d5f58f8b8f5 * 'VirtualMailManager/Exceptions.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 47
diff changeset
    37
    def __init__(self, msg, code):
0d5f58f8b8f5 * 'VirtualMailManager/Exceptions.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 47
diff changeset
    38
        VMMException.__init__(self, msg, code)
0d5f58f8b8f5 * 'VirtualMailManager/Exceptions.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 47
diff changeset
    39
0d5f58f8b8f5 * 'VirtualMailManager/Exceptions.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 47
diff changeset
    40
class VMMNotRootException(VMMException):
32
ceb700bc4a80 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 8
diff changeset
    41
    """Exception class for non-root exceptions"""
48
0d5f58f8b8f5 * 'VirtualMailManager/Exceptions.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 47
diff changeset
    42
    def __init__(self, msg, code):
0d5f58f8b8f5 * 'VirtualMailManager/Exceptions.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 47
diff changeset
    43
        VMMException.__init__(self, msg, code)
0
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    44
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    45
class VMMDomainException(VMMException):
32
ceb700bc4a80 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 8
diff changeset
    46
    """Exception class for Domain exceptions"""
48
0d5f58f8b8f5 * 'VirtualMailManager/Exceptions.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 47
diff changeset
    47
    def __init__(self, msg, code):
0d5f58f8b8f5 * 'VirtualMailManager/Exceptions.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 47
diff changeset
    48
        VMMException.__init__(self, msg, code)
0
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    49
47
191d5a5adc4a * Removed gettext import and setup in VirtualMailManager/:
Pascal Volk <neverseen@users.sourceforge.net>
parents: 32
diff changeset
    50
class VMMDomainAliasException(VMMException):
191d5a5adc4a * Removed gettext import and setup in VirtualMailManager/:
Pascal Volk <neverseen@users.sourceforge.net>
parents: 32
diff changeset
    51
    """Exception class for DomainAlias exceptions"""
48
0d5f58f8b8f5 * 'VirtualMailManager/Exceptions.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 47
diff changeset
    52
    def __init__(self, msg, code):
0d5f58f8b8f5 * 'VirtualMailManager/Exceptions.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 47
diff changeset
    53
        VMMException.__init__(self, msg, code)
47
191d5a5adc4a * Removed gettext import and setup in VirtualMailManager/:
Pascal Volk <neverseen@users.sourceforge.net>
parents: 32
diff changeset
    54
0
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    55
class VMMAccountException(VMMException):
32
ceb700bc4a80 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 8
diff changeset
    56
    """Exception class for Account exceptions"""
48
0d5f58f8b8f5 * 'VirtualMailManager/Exceptions.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 47
diff changeset
    57
    def __init__(self, msg, code):
0d5f58f8b8f5 * 'VirtualMailManager/Exceptions.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 47
diff changeset
    58
        VMMException.__init__(self, msg, code)
0
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    59
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    60
class VMMAliasException(VMMException):
8
7e3ce56f49e6 * 'create_tables.pgsql'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 4
diff changeset
    61
    """Exception class for Alias exceptions"""
48
0d5f58f8b8f5 * 'VirtualMailManager/Exceptions.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 47
diff changeset
    62
    def __init__(self, msg, code):
0d5f58f8b8f5 * 'VirtualMailManager/Exceptions.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 47
diff changeset
    63
        VMMException.__init__(self, msg, code)
8
7e3ce56f49e6 * 'create_tables.pgsql'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 4
diff changeset
    64
7e3ce56f49e6 * 'create_tables.pgsql'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 4
diff changeset
    65
class VMMMailLocationException(VMMException):
7e3ce56f49e6 * 'create_tables.pgsql'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 4
diff changeset
    66
    """Exception class for MailLocation exceptions"""
48
0d5f58f8b8f5 * 'VirtualMailManager/Exceptions.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 47
diff changeset
    67
    def __init__(self, msg, code):
0d5f58f8b8f5 * 'VirtualMailManager/Exceptions.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 47
diff changeset
    68
        VMMException.__init__(self, msg, code)
8
7e3ce56f49e6 * 'create_tables.pgsql'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 4
diff changeset
    69
7e3ce56f49e6 * 'create_tables.pgsql'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 4
diff changeset
    70
class VMMTransportException(VMMException):
7e3ce56f49e6 * 'create_tables.pgsql'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 4
diff changeset
    71
    """Exception class for Transport exceptions"""
48
0d5f58f8b8f5 * 'VirtualMailManager/Exceptions.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 47
diff changeset
    72
    def __init__(self, msg, code):
0d5f58f8b8f5 * 'VirtualMailManager/Exceptions.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 47
diff changeset
    73
        VMMException.__init__(self, msg, code)
8
7e3ce56f49e6 * 'create_tables.pgsql'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 4
diff changeset
    74