VirtualMailManager/errors.py
author martin f. krafft <madduck@madduck.net>
Sat, 07 Apr 2012 00:45:57 +0200
branchv0.6.x
changeset 492 e5c2b3647971
parent 449 6826acb9b0a7
child 568 14abdd04ddf5
permissions -rw-r--r--
Modify address check query to obtain well-defined result The way in which UNION does not yield the desired result, because (a) UNION merges results and (b) the result order is undefined. This patch changes the query to select the counts as columns and hence provides a well-defined order.
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 -*-
366
d6573da35b5f Updated copyright notices to include the year 2011.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 320
diff changeset
     2
# Copyright (c) 2007 - 2011, Pascal Volk
0
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
     3
# See COPYING for distribution information.
214
84e6e898e6c5 VMM/Exceptions: use the inherited CTor in all VMM*Exception classes.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 162
diff changeset
     4
"""
216
0c8c053b451c Moved VirtualMailManager/Exceptions to VirtualMailManager/errors.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 214
diff changeset
     5
    VirtualMailManager.errors
320
011066435e6f VMM/*: Made all modules names lowercase, adjusted imports.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 216
diff changeset
     6
    ~~~~~~~~~~~~~~~~~~~~~~~~~
214
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
216
0c8c053b451c Moved VirtualMailManager/Exceptions to VirtualMailManager/errors.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 214
diff changeset
    12
class VMMError(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)
216
0c8c053b451c Moved VirtualMailManager/Exceptions to VirtualMailManager/errors.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 214
diff changeset
    17
        self.msg = msg
0c8c053b451c Moved VirtualMailManager/Exceptions to VirtualMailManager/errors.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 214
diff changeset
    18
        self.code = int(code)
0
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    19
216
0c8c053b451c Moved VirtualMailManager/Exceptions to VirtualMailManager/errors.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 214
diff changeset
    20
    def __repr__(self):
0c8c053b451c Moved VirtualMailManager/Exceptions to VirtualMailManager/errors.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 214
diff changeset
    21
        return '%s(%r, %r)' % (self.__class__.__name__, self.msg, self.code)
48
0d5f58f8b8f5 * 'VirtualMailManager/Exceptions.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 47
diff changeset
    22
320
011066435e6f VMM/*: Made all modules names lowercase, adjusted imports.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 216
diff changeset
    23
216
0c8c053b451c Moved VirtualMailManager/Exceptions to VirtualMailManager/errors.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 214
diff changeset
    24
class ConfigError(VMMError):
214
84e6e898e6c5 VMM/Exceptions: use the inherited CTor in all VMM*Exception classes.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 162
diff changeset
    25
    """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
    26
    pass
84e6e898e6c5 VMM/Exceptions: use the inherited CTor in all VMM*Exception classes.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 162
diff changeset
    27
0
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    28
216
0c8c053b451c Moved VirtualMailManager/Exceptions to VirtualMailManager/errors.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 214
diff changeset
    29
class PermissionError(VMMError):
48
0d5f58f8b8f5 * 'VirtualMailManager/Exceptions.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 47
diff changeset
    30
    """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
    31
    pass
84e6e898e6c5 VMM/Exceptions: use the inherited CTor in all VMM*Exception classes.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 162
diff changeset
    32
48
0d5f58f8b8f5 * 'VirtualMailManager/Exceptions.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 47
diff changeset
    33
216
0c8c053b451c Moved VirtualMailManager/Exceptions to VirtualMailManager/errors.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 214
diff changeset
    34
class NotRootError(VMMError):
32
ceb700bc4a80 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 8
diff changeset
    35
    """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
    36
    pass
84e6e898e6c5 VMM/Exceptions: use the inherited CTor in all VMM*Exception classes.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 162
diff changeset
    37
0
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    38
216
0c8c053b451c Moved VirtualMailManager/Exceptions to VirtualMailManager/errors.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 214
diff changeset
    39
class DomainError(VMMError):
32
ceb700bc4a80 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 8
diff changeset
    40
    """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
    41
    pass
84e6e898e6c5 VMM/Exceptions: use the inherited CTor in all VMM*Exception classes.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 162
diff changeset
    42
0
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    43
216
0c8c053b451c Moved VirtualMailManager/Exceptions to VirtualMailManager/errors.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 214
diff changeset
    44
class AliasDomainError(VMMError):
55
15c873f94ba6 * 'VirtualMailManager/Exceptions.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 48
diff changeset
    45
    """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
    46
    pass
84e6e898e6c5 VMM/Exceptions: use the inherited CTor in all VMM*Exception classes.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 162
diff changeset
    47
47
191d5a5adc4a * Removed gettext import and setup in VirtualMailManager/:
Pascal Volk <neverseen@users.sourceforge.net>
parents: 32
diff changeset
    48
216
0c8c053b451c Moved VirtualMailManager/Exceptions to VirtualMailManager/errors.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 214
diff changeset
    49
class AccountError(VMMError):
32
ceb700bc4a80 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 8
diff changeset
    50
    """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
    51
    pass
84e6e898e6c5 VMM/Exceptions: use the inherited CTor in all VMM*Exception classes.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 162
diff changeset
    52
0
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    53
216
0c8c053b451c Moved VirtualMailManager/Exceptions to VirtualMailManager/errors.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 214
diff changeset
    54
class AliasError(VMMError):
8
7e3ce56f49e6 * 'create_tables.pgsql'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 4
diff changeset
    55
    """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
    56
    pass
84e6e898e6c5 VMM/Exceptions: use the inherited CTor in all VMM*Exception classes.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 162
diff changeset
    57
8
7e3ce56f49e6 * 'create_tables.pgsql'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 4
diff changeset
    58
216
0c8c053b451c Moved VirtualMailManager/Exceptions to VirtualMailManager/errors.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 214
diff changeset
    59
class EmailAddressError(VMMError):
76
14c0a092d7d2 * 'VirtualMailManager/EmailAddress.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 61
diff changeset
    60
    """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
    61
    pass
84e6e898e6c5 VMM/Exceptions: use the inherited CTor in all VMM*Exception classes.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 162
diff changeset
    62
76
14c0a092d7d2 * 'VirtualMailManager/EmailAddress.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 61
diff changeset
    63
216
0c8c053b451c Moved VirtualMailManager/Exceptions to VirtualMailManager/errors.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 214
diff changeset
    64
class MailLocationError(VMMError):
8
7e3ce56f49e6 * 'create_tables.pgsql'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 4
diff changeset
    65
    """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
    66
    pass
84e6e898e6c5 VMM/Exceptions: use the inherited CTor in all VMM*Exception classes.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 162
diff changeset
    67
8
7e3ce56f49e6 * 'create_tables.pgsql'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 4
diff changeset
    68
216
0c8c053b451c Moved VirtualMailManager/Exceptions to VirtualMailManager/errors.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 214
diff changeset
    69
class RelocatedError(VMMError):
76
14c0a092d7d2 * 'VirtualMailManager/EmailAddress.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 61
diff changeset
    70
    """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
    71
    pass