VirtualMailManager/constants.py
author martin f. krafft <madduck@madduck.net>
Sun, 15 Apr 2012 13:17:21 +0200
branchv0.6.x
changeset 555 499c63f52462
parent 478 6278a7a2a476
child 568 14abdd04ddf5
permissions -rw-r--r--
Provide list{addresses,aliases,users,relocated} subcommands The patch provides the list{addresses,aliases,users,relocated} subcommands to the UI. All commands actually take the same path in the code and only one query is run with different parameters for each case. There are still two shortcomings: 1. With alias domains, the output order is not as one might want it, e.g. foo@example.org bar@example.org foo@example.com bar@example.com when it should really be foo@ twice and then bar@ twice. I have not found a way to modify the SQL accordingly. 2. The SELECT queries for Accounts, Alias and Relocated are hard-coded in common.py.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
316
31d8931dc535 VMM/constants: Replaced the constants subpackage by a module.
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: 324
diff changeset
     2
# Copyright (c) 2007 - 2011, Pascal Volk
316
31d8931dc535 VMM/constants: Replaced the constants subpackage by a module.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
     3
# See COPYING for distribution information.
31d8931dc535 VMM/constants: Replaced the constants subpackage by a module.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
     4
"""
31d8931dc535 VMM/constants: Replaced the constants subpackage by a module.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
     5
    VirtualMailManager.constants
31d8931dc535 VMM/constants: Replaced the constants subpackage by a module.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
     6
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
31d8931dc535 VMM/constants: Replaced the constants subpackage by a module.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
     7
31d8931dc535 VMM/constants: Replaced the constants subpackage by a module.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
     8
    VirtualMailManager's constants:
31d8931dc535 VMM/constants: Replaced the constants subpackage by a module.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
     9
        * version information
324
38e344ba3d0f VMM/constants: Added MIN_GID and MIN_UID.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 317
diff changeset
    10
        * upper and lower limits MIN_* / MAX_*
316
31d8931dc535 VMM/constants: Replaced the constants subpackage by a module.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    11
        * exit codes
31d8931dc535 VMM/constants: Replaced the constants subpackage by a module.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    12
        * error codes
31d8931dc535 VMM/constants: Replaced the constants subpackage by a module.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    13
"""
31d8931dc535 VMM/constants: Replaced the constants subpackage by a module.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    14
# version information
31d8931dc535 VMM/constants: Replaced the constants subpackage by a module.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    15
31d8931dc535 VMM/constants: Replaced the constants subpackage by a module.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    16
__all__ = ['__author__', '__date__', '__version__']
478
6278a7a2a476 Updated the author's e-mail address.
Pascal Volk <user@localhost.localdomain.org>
parents: 452
diff changeset
    17
AUTHOR = 'Pascal Volk <user+vmm@localhost.localdomain.org>'
316
31d8931dc535 VMM/constants: Replaced the constants subpackage by a module.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    18
RELDATE = '2009-09-09'
31d8931dc535 VMM/constants: Replaced the constants subpackage by a module.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    19
VERSION = '0.5.2'
31d8931dc535 VMM/constants: Replaced the constants subpackage by a module.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    20
__author__ = AUTHOR
366
d6573da35b5f Updated copyright notices to include the year 2011.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 324
diff changeset
    21
__copyright__ = 'Copyright (c) 2007-2011 %s' % __author__
316
31d8931dc535 VMM/constants: Replaced the constants subpackage by a module.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    22
__date__ = RELDATE
31d8931dc535 VMM/constants: Replaced the constants subpackage by a module.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    23
__version__ = VERSION
31d8931dc535 VMM/constants: Replaced the constants subpackage by a module.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    24
31d8931dc535 VMM/constants: Replaced the constants subpackage by a module.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    25
324
38e344ba3d0f VMM/constants: Added MIN_GID and MIN_UID.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 317
diff changeset
    26
# limits
38e344ba3d0f VMM/constants: Added MIN_GID and MIN_UID.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 317
diff changeset
    27
38e344ba3d0f VMM/constants: Added MIN_GID and MIN_UID.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 317
diff changeset
    28
MIN_GID = 70000
38e344ba3d0f VMM/constants: Added MIN_GID and MIN_UID.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 317
diff changeset
    29
MIN_UID = 70000
38e344ba3d0f VMM/constants: Added MIN_GID and MIN_UID.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 317
diff changeset
    30
38e344ba3d0f VMM/constants: Added MIN_GID and MIN_UID.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 317
diff changeset
    31
316
31d8931dc535 VMM/constants: Replaced the constants subpackage by a module.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    32
# exit codes
31d8931dc535 VMM/constants: Replaced the constants subpackage by a module.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    33
31d8931dc535 VMM/constants: Replaced the constants subpackage by a module.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    34
EX_SUCCESS = 0
31d8931dc535 VMM/constants: Replaced the constants subpackage by a module.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    35
EX_MISSING_ARGS = 1
31d8931dc535 VMM/constants: Replaced the constants subpackage by a module.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    36
EX_UNKNOWN_COMMAND = 2
31d8931dc535 VMM/constants: Replaced the constants subpackage by a module.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    37
EX_USER_INTERRUPT = 3
31d8931dc535 VMM/constants: Replaced the constants subpackage by a module.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    38
31d8931dc535 VMM/constants: Replaced the constants subpackage by a module.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    39
31d8931dc535 VMM/constants: Replaced the constants subpackage by a module.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    40
# error codes
31d8931dc535 VMM/constants: Replaced the constants subpackage by a module.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    41
31d8931dc535 VMM/constants: Replaced the constants subpackage by a module.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    42
ACCOUNT_AND_ALIAS_PRESENT = 20
31d8931dc535 VMM/constants: Replaced the constants subpackage by a module.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    43
ACCOUNT_EXISTS = 21
31d8931dc535 VMM/constants: Replaced the constants subpackage by a module.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    44
ACCOUNT_MISSING_PASSWORD = 69
31d8931dc535 VMM/constants: Replaced the constants subpackage by a module.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    45
ALIASDOMAIN_EXISTS = 23
31d8931dc535 VMM/constants: Replaced the constants subpackage by a module.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    46
ALIASDOMAIN_ISDOMAIN = 24
31d8931dc535 VMM/constants: Replaced the constants subpackage by a module.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    47
ALIASDOMAIN_NO_DOMDEST = 25
31d8931dc535 VMM/constants: Replaced the constants subpackage by a module.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    48
ALIAS_EXCEEDS_EXPANSION_LIMIT = 27
31d8931dc535 VMM/constants: Replaced the constants subpackage by a module.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    49
ALIAS_EXISTS = 28
31d8931dc535 VMM/constants: Replaced the constants subpackage by a module.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    50
ALIAS_PRESENT = 30
31d8931dc535 VMM/constants: Replaced the constants subpackage by a module.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    51
CONF_ERROR = 31
31d8931dc535 VMM/constants: Replaced the constants subpackage by a module.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    52
CONF_NOFILE = 32
31d8931dc535 VMM/constants: Replaced the constants subpackage by a module.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    53
CONF_NOPERM = 33
31d8931dc535 VMM/constants: Replaced the constants subpackage by a module.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    54
CONF_WRONGPERM = 34
31d8931dc535 VMM/constants: Replaced the constants subpackage by a module.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    55
DATABASE_ERROR = 35
31d8931dc535 VMM/constants: Replaced the constants subpackage by a module.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    56
DOMAINDIR_GROUP_MISMATCH = 36
31d8931dc535 VMM/constants: Replaced the constants subpackage by a module.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    57
DOMAIN_ALIAS_EXISTS = 37
31d8931dc535 VMM/constants: Replaced the constants subpackage by a module.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    58
DOMAIN_EXISTS = 38
31d8931dc535 VMM/constants: Replaced the constants subpackage by a module.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    59
DOMAIN_INVALID = 39
31d8931dc535 VMM/constants: Replaced the constants subpackage by a module.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    60
DOMAIN_NO_NAME = 40
31d8931dc535 VMM/constants: Replaced the constants subpackage by a module.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    61
DOMAIN_TOO_LONG = 41
31d8931dc535 VMM/constants: Replaced the constants subpackage by a module.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    62
FOUND_DOTS_IN_PATH = 42
31d8931dc535 VMM/constants: Replaced the constants subpackage by a module.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    63
INVALID_ADDRESS = 43
31d8931dc535 VMM/constants: Replaced the constants subpackage by a module.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    64
INVALID_ARGUMENT = 44
31d8931dc535 VMM/constants: Replaced the constants subpackage by a module.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    65
INVALID_MAIL_LOCATION = 70
31d8931dc535 VMM/constants: Replaced the constants subpackage by a module.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    66
INVALID_SECTION = 46
31d8931dc535 VMM/constants: Replaced the constants subpackage by a module.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    67
LOCALPART_INVALID = 47
31d8931dc535 VMM/constants: Replaced the constants subpackage by a module.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    68
LOCALPART_TOO_LONG = 48
31d8931dc535 VMM/constants: Replaced the constants subpackage by a module.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    69
MAILDIR_PERM_MISMATCH = 49
31d8931dc535 VMM/constants: Replaced the constants subpackage by a module.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    70
MAILLOCATION_INIT = 50
31d8931dc535 VMM/constants: Replaced the constants subpackage by a module.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    71
NOT_EXECUTABLE = 51
31d8931dc535 VMM/constants: Replaced the constants subpackage by a module.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    72
NO_SUCH_ACCOUNT = 52
31d8931dc535 VMM/constants: Replaced the constants subpackage by a module.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    73
NO_SUCH_ALIAS = 53
31d8931dc535 VMM/constants: Replaced the constants subpackage by a module.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    74
NO_SUCH_ALIASDOMAIN = 54
31d8931dc535 VMM/constants: Replaced the constants subpackage by a module.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    75
NO_SUCH_BINARY = 55
31d8931dc535 VMM/constants: Replaced the constants subpackage by a module.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    76
NO_SUCH_DIRECTORY = 56
31d8931dc535 VMM/constants: Replaced the constants subpackage by a module.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    77
NO_SUCH_DOMAIN = 57
31d8931dc535 VMM/constants: Replaced the constants subpackage by a module.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    78
NO_SUCH_RELOCATED = 58
31d8931dc535 VMM/constants: Replaced the constants subpackage by a module.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    79
RELOCATED_ADDR_DEST_IDENTICAL = 59
31d8931dc535 VMM/constants: Replaced the constants subpackage by a module.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    80
RELOCATED_EXISTS = 60
31d8931dc535 VMM/constants: Replaced the constants subpackage by a module.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    81
UNKNOWN_SERVICE = 65
31d8931dc535 VMM/constants: Replaced the constants subpackage by a module.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    82
VMM_ERROR = 67
31d8931dc535 VMM/constants: Replaced the constants subpackage by a module.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    83
VMM_TOO_MANY_FAILURES = 68
555
499c63f52462 Provide list{addresses,aliases,users,relocated} subcommands
martin f. krafft <madduck@madduck.net>
parents: 478
diff changeset
    84
499c63f52462 Provide list{addresses,aliases,users,relocated} subcommands
martin f. krafft <madduck@madduck.net>
parents: 478
diff changeset
    85
# address types
499c63f52462 Provide list{addresses,aliases,users,relocated} subcommands
martin f. krafft <madduck@madduck.net>
parents: 478
diff changeset
    86
499c63f52462 Provide list{addresses,aliases,users,relocated} subcommands
martin f. krafft <madduck@madduck.net>
parents: 478
diff changeset
    87
TYPE_ACCOUNT = 0x1
499c63f52462 Provide list{addresses,aliases,users,relocated} subcommands
martin f. krafft <madduck@madduck.net>
parents: 478
diff changeset
    88
TYPE_ALIAS = 0x2
499c63f52462 Provide list{addresses,aliases,users,relocated} subcommands
martin f. krafft <madduck@madduck.net>
parents: 478
diff changeset
    89
TYPE_RELOCATED = 0x4