VMM/constants: Replaced the constants subpackage by a module. v0.6.x
authorPascal Volk <neverseen@users.sourceforge.net>
Mon, 26 Jul 2010 19:10:51 +0000
branchv0.6.x
changeset 316 31d8931dc535
parent 315 81bccfd14355
child 317 d619e97a8f18
VMM/constants: Replaced the constants subpackage by a module.
VirtualMailManager/Account.py
VirtualMailManager/Alias.py
VirtualMailManager/AliasDomain.py
VirtualMailManager/Config.py
VirtualMailManager/Domain.py
VirtualMailManager/EmailAddress.py
VirtualMailManager/Handler.py
VirtualMailManager/Relocated.py
VirtualMailManager/Transport.py
VirtualMailManager/__init__.py
VirtualMailManager/cli/Config.py
VirtualMailManager/cli/Handler.py
VirtualMailManager/cli/__init__.py
VirtualMailManager/common.py
VirtualMailManager/constants.py
VirtualMailManager/constants/ERROR.py
VirtualMailManager/constants/EXIT.py
VirtualMailManager/constants/__init__.py
VirtualMailManager/constants/version.py
VirtualMailManager/ext/Postconf.py
VirtualMailManager/mailbox.py
VirtualMailManager/maillocation.py
VirtualMailManager/password.py
--- a/VirtualMailManager/Account.py	Mon Jul 26 16:08:15 2010 +0000
+++ b/VirtualMailManager/Account.py	Mon Jul 26 19:10:51 2010 +0000
@@ -13,10 +13,10 @@
 from VirtualMailManager.EmailAddress import EmailAddress
 from VirtualMailManager.Transport import Transport
 from VirtualMailManager.common import version_str
-from VirtualMailManager.constants.ERROR import \
+from VirtualMailManager.constants import \
      ACCOUNT_EXISTS, ACCOUNT_MISSING_PASSWORD, ALIAS_PRESENT, \
-     INVALID_AGUMENT, INVALID_MAIL_LOCATION, NO_SUCH_ACCOUNT, NO_SUCH_DOMAIN, \
-     UNKNOWN_SERVICE
+     INVALID_ARGUMENT, INVALID_MAIL_LOCATION, NO_SUCH_ACCOUNT, \
+     NO_SUCH_DOMAIN, UNKNOWN_SERVICE
 from VirtualMailManager.errors import AccountError as AErr
 from VirtualMailManager.maillocation import MailLocation
 from VirtualMailManager.password import pwhash
@@ -276,7 +276,7 @@
           The new value of the attribute.
         """
         if field not in ('name', 'password', 'transport'):
-            raise AErr(_(u"Unknown field: '%s'") % field, INVALID_AGUMENT)
+            raise AErr(_(u"Unknown field: '%s'") % field, INVALID_ARGUMENT)
         self._chk_state()
         dbc = self._dbh.cursor()
         if field == 'password':
@@ -402,9 +402,9 @@
     try:
         uid = long(uid)
     except ValueError:
-        raise AErr(_(u'UID must be an int/long.'), INVALID_AGUMENT)
+        raise AErr(_(u'UID must be an int/long.'), INVALID_ARGUMENT)
     if uid < 1:
-        raise AErr(_(u'UID must be greater than 0.'), INVALID_AGUMENT)
+        raise AErr(_(u'UID must be greater than 0.'), INVALID_ARGUMENT)
     dbc = dbh.cursor()
     dbc.execute("SELECT local_part||'@'|| domain_name.domainname AS address, "
                 "uid, users.gid FROM users LEFT JOIN domain_name ON "
--- a/VirtualMailManager/Alias.py	Mon Jul 26 16:08:15 2010 +0000
+++ b/VirtualMailManager/Alias.py	Mon Jul 26 19:10:51 2010 +0000
@@ -13,7 +13,7 @@
 from VirtualMailManager.errors import AliasError as AErr
 from VirtualMailManager.ext.Postconf import Postconf
 from VirtualMailManager.pycompat import all
-from VirtualMailManager.constants.ERROR import \
+from VirtualMailManager.constants import \
      ALIAS_EXCEEDS_EXPANSION_LIMIT, NO_SUCH_ALIAS, NO_SUCH_DOMAIN
 
 
--- a/VirtualMailManager/AliasDomain.py	Mon Jul 26 16:08:15 2010 +0000
+++ b/VirtualMailManager/AliasDomain.py	Mon Jul 26 19:10:51 2010 +0000
@@ -9,7 +9,7 @@
 """
 
 from VirtualMailManager.Domain import Domain, check_domainname
-from VirtualMailManager.constants.ERROR import \
+from VirtualMailManager.constants import \
      ALIASDOMAIN_EXISTS, ALIASDOMAIN_ISDOMAIN, ALIASDOMAIN_NO_DOMDEST, \
      NO_SUCH_ALIASDOMAIN, NO_SUCH_DOMAIN
 from VirtualMailManager.errors import AliasDomainError as ADErr
--- a/VirtualMailManager/Config.py	Mon Jul 26 16:08:15 2010 +0000
+++ b/VirtualMailManager/Config.py	Mon Jul 26 19:10:51 2010 +0000
@@ -17,7 +17,7 @@
 from cStringIO import StringIO# TODO: move interactive stff to cli
 
 from VirtualMailManager.common import exec_ok, get_unicode, is_dir, version_hex
-from VirtualMailManager.constants.ERROR import CONF_ERROR
+from VirtualMailManager.constants import CONF_ERROR
 from VirtualMailManager.errors import ConfigError, VMMError
 from VirtualMailManager.maillocation import known_format
 from VirtualMailManager.password import verify_scheme as _verify_scheme
--- a/VirtualMailManager/Domain.py	Mon Jul 26 16:08:15 2010 +0000
+++ b/VirtualMailManager/Domain.py	Mon Jul 26 19:10:51 2010 +0000
@@ -12,7 +12,7 @@
 import re
 from random import choice
 
-from VirtualMailManager.constants.ERROR import \
+from VirtualMailManager.constants import \
      ACCOUNT_AND_ALIAS_PRESENT, ACCOUNT_PRESENT, ALIAS_PRESENT, \
      DOMAIN_ALIAS_EXISTS, DOMAIN_EXISTS, DOMAIN_INVALID, DOMAIN_TOO_LONG, \
      NO_SUCH_DOMAIN
--- a/VirtualMailManager/EmailAddress.py	Mon Jul 26 16:08:15 2010 +0000
+++ b/VirtualMailManager/EmailAddress.py	Mon Jul 26 19:10:51 2010 +0000
@@ -10,7 +10,7 @@
 import re
 
 from VirtualMailManager.Domain import check_domainname
-from VirtualMailManager.constants.ERROR import \
+from VirtualMailManager.constants import \
      DOMAIN_NO_NAME, INVALID_ADDRESS, LOCALPART_INVALID, LOCALPART_TOO_LONG
 from VirtualMailManager.errors import EmailAddressError as EAErr
 
--- a/VirtualMailManager/Handler.py	Mon Jul 26 16:08:15 2010 +0000
+++ b/VirtualMailManager/Handler.py	Mon Jul 26 19:10:51 2010 +0000
@@ -20,12 +20,17 @@
 
 from pyPgSQL import PgSQL  # python-pgsql - http://pypgsql.sourceforge.net
 
-import VirtualMailManager.constants.ERROR as ERR
 from VirtualMailManager.Account import Account
 from VirtualMailManager.Alias import Alias
 from VirtualMailManager.AliasDomain import AliasDomain
 from VirtualMailManager.common import exec_ok
 from VirtualMailManager.Config import Config as Cfg
+from VirtualMailManager.constants import \
+     ACCOUNT_EXISTS, ALIAS_EXISTS, CONF_NOFILE, CONF_NOPERM, CONF_WRONGPERM, \
+     DATABASE_ERROR, DOMAINDIR_GROUP_MISMATCH, DOMAIN_INVALID, \
+     FOUND_DOTS_IN_PATH, INVALID_ARGUMENT, MAILDIR_PERM_MISMATCH, \
+     NOT_EXECUTABLE, NO_SUCH_ACCOUNT, NO_SUCH_ALIAS, NO_SUCH_BINARY, \
+     NO_SUCH_DIRECTORY, NO_SUCH_RELOCATED, RELOCATED_EXISTS
 from VirtualMailManager.Domain import Domain, get_gid
 from VirtualMailManager.EmailAddress import EmailAddress
 from VirtualMailManager.errors import \
@@ -43,9 +48,9 @@
 TYPE_ALIAS = 0x2
 TYPE_RELOCATED = 0x4
 OTHER_TYPES = {
-    TYPE_ACCOUNT: (_(u'an account'), ERR.ACCOUNT_EXISTS),
-    TYPE_ALIAS: (_(u'an alias'), ERR.ALIAS_EXISTS),
-    TYPE_RELOCATED: (_(u'a relocated user'), ERR.RELOCATED_EXISTS),
+    TYPE_ACCOUNT: (_(u'an account'), ACCOUNT_EXISTS),
+    TYPE_ALIAS: (_(u'an alias'), ALIAS_EXISTS),
+    TYPE_RELOCATED: (_(u'a relocated user'), RELOCATED_EXISTS),
 }
 
 
@@ -71,7 +76,7 @@
 
         if os.geteuid():
             raise NotRootError(_(u"You are not root.\n\tGood bye!\n"),
-                               ERR.CONF_NOPERM)
+                               CONF_NOPERM)
         if self.__chkCfgFile():
             self._Cfg = Cfg(self._cfgFileName)
             self._Cfg.load()
@@ -87,7 +92,7 @@
                 break
         if not len(self._cfgFileName):
             raise VMMError(_(u"No 'vmm.cfg' found in: "
-                             u"/root:/usr/local/etc:/etc"), ERR.CONF_NOFILE)
+                             u"/root:/usr/local/etc:/etc"), CONF_NOFILE)
 
     def __chkCfgFile(self):
         """Checks the configuration file, returns bool"""
@@ -99,7 +104,7 @@
             raise PermissionError(_(u"wrong permissions for '%(file)s': "
                                     u"%(perms)s\n`chmod 0600 %(file)s` would "
                                     u"be great.") % {'file': self._cfgFileName,
-                                  'perms': fmode}, ERR.CONF_WRONGPERM)
+                                  'perms': fmode}, CONF_WRONGPERM)
         else:
             return True
 
@@ -114,16 +119,16 @@
         elif not os.path.isdir(basedir):
             raise VMMError(_(u"'%s' is not a directory.\n(vmm.cfg: section "
                              u"'misc', option 'base_directory')") % basedir,
-                           ERR.NO_SUCH_DIRECTORY)
+                           NO_SUCH_DIRECTORY)
         for opt, val in self._Cfg.items('bin'):
             try:
                 exec_ok(val)
             except VMMError, err:
-                if err.code is ERR.NO_SUCH_BINARY:
+                if err.code is NO_SUCH_BINARY:
                     raise VMMError(_(u"'%(binary)s' doesn't exist.\n(vmm.cfg: "
                                      u"section 'bin', option '%(option)s')") %
                                    {'binary': val, 'option': opt}, err.code)
-                elif err.code is ERR.NOT_EXECUTABLE:
+                elif err.code is NOT_EXECUTABLE:
                     raise VMMError(_(u"'%(binary)s' is not executable.\n"
                                      u"(vmm.cfg: section 'bin', option "
                                      u"'%(option)s')") % {'binary': val,
@@ -146,7 +151,7 @@
                 dbc.execute("SET NAMES 'UTF8'")
                 dbc.close()
             except PgSQL.libpq.DatabaseError, e:
-                raise VMMError(str(e), ERR.DATABASE_ERROR)
+                raise VMMError(str(e), DATABASE_ERROR)
 
     def _chk_other_address_types(self, address, exclude):
         """Checks if the EmailAddress *address* is known as `TYPE_ACCOUNT`,
@@ -246,19 +251,20 @@
             userdir = '%s' % uid
             if userdir.count('..') or domdir.count('..'):
                 raise VMMError(_(u'Found ".." in home directory path.'),
-                                   ERR.FOUND_DOTS_IN_PATH)
+                               FOUND_DOTS_IN_PATH)
             if os.path.isdir(domdir):
                 os.chdir(domdir)
                 if os.path.isdir(userdir):
                     mdstat = os.stat(userdir)
                     if (mdstat.st_uid, mdstat.st_gid) != (uid, gid):
-                        raise VMMError(_(
-                          u'Detected owner/group mismatch in home directory.'),
-                          ERR.MAILDIR_PERM_MISMATCH)
+                        raise VMMError(_(u'Detected owner/group mismatch in '
+                                         u'home directory.'),
+                                       MAILDIR_PERM_MISMATCH)
                     rmtree(userdir, ignore_errors=True)
                 else:
                     raise VMMError(_(u"No such directory: %s") %
-                        os.path.join(domdir, userdir), ERR.NO_SUCH_DIRECTORY)
+                                   os.path.join(domdir, userdir),
+                                   NO_SUCH_DIRECTORY)
 
     def __domDirDelete(self, domdir, gid):
         if gid > 0:
@@ -269,13 +275,12 @@
             domdirparent = os.path.join(basedir, domdirdirs[0])
             if basedir.count('..') or domdir.count('..'):
                 raise VMMError(_(u'Found ".." in domain directory path.'),
-                        ERR.FOUND_DOTS_IN_PATH)
+                               FOUND_DOTS_IN_PATH)
             if os.path.isdir(domdirparent):
                 os.chdir(domdirparent)
                 if os.lstat(domdirdirs[1]).st_gid != gid:
-                    raise VMMError(_(
-                        u'Detected group mismatch in domain directory.'),
-                        ERR.DOMAINDIR_GROUP_MISMATCH)
+                    raise VMMError(_(u'Detected group mismatch in domain '
+                                     u'directory.'), DOMAINDIR_GROUP_MISMATCH)
                 rmtree(domdirdirs[1], ignore_errors=True)
 
     def hasWarnings(self):
@@ -321,8 +326,8 @@
 
     def domainTransport(self, domainname, transport, force=None):
         if force is not None and force != 'force':
-            raise DomainError(_(u"Invalid argument: ā€œ%sā€") % force,
-                ERR.INVALID_OPTION)
+            raise DomainError(_(u"Invalid argument: '%s'") % force,
+                              INVALID_ARGUMENT)
         dom = self.__getDomain(domainname)
         trsp = Transport(self._dbh, transport=transport)
         if force is None:
@@ -333,7 +338,7 @@
     def domainDelete(self, domainname, force=None):
         if force and force not in ('deluser', 'delalias', 'delall'):
             raise DomainError(_(u"Invalid argument: '%s'") % force,
-                              ERR.INVALID_OPTION)
+                              INVALID_ARGUMENT)
         dom = self.__getDomain(domainname)
         gid = dom.gid
         domdir = dom.directory
@@ -352,7 +357,7 @@
         if details not in [None, 'accounts', 'aliasdomains', 'aliases', 'full',
                            'relocated']:
             raise VMMError(_(u'Invalid argument: ā€œ%sā€') % details,
-                               ERR.INVALID_AGUMENT)
+                           INVALID_ARGUMENT)
         dom = self.__getDomain(domainname)
         dominfo = dom.get_info()
         if dominfo['domainname'].startswith('xn--'):
@@ -428,7 +433,7 @@
             like = True
             if not re.match(RE_DOMAIN_SEARCH, pattern.strip('%')):
                 raise VMMError(_(u"The pattern '%s' contains invalid "
-                                 u"characters.") % pattern, ERR.DOMAIN_INVALID)
+                                 u"characters.") % pattern, DOMAIN_INVALID)
         self.__dbConnect()
         return search(self._dbh, pattern=pattern, like=like)
 
@@ -470,11 +475,11 @@
         """Wrapper around Account.delete(...)"""
         if force not in (None, 'delalias'):
             raise VMMError(_(u"Invalid argument: '%s'") % force,
-                           ERR.INVALID_AGUMENT)
+                           INVALID_ARGUMENT)
         acc = self.__getAccount(emailaddress)
         if not acc:
             raise VMMError(_(u"The account '%s' doesn't exist.") %
-                           acc.address, ERR.NO_SUCH_ACCOUNT)
+                           acc.address, NO_SUCH_ACCOUNT)
         uid = acc.uid
         gid = acc.gid
         dom_dir = acc.domain_directory
@@ -484,8 +489,8 @@
             try:
                 self.__userDirDelete(dom_dir, uid, gid)
             except VMMError, err:
-                if err.code in (ERR.FOUND_DOTS_IN_PATH,
-                        ERR.MAILDIR_PERM_MISMATCH, ERR.NO_SUCH_DIRECTORY):
+                if err.code in (FOUND_DOTS_IN_PATH, MAILDIR_PERM_MISMATCH,
+                                NO_SUCH_DIRECTORY):
                     warning = _(u"""\
 The account has been successfully deleted from the database.
     But an error occurred while deleting the following directory:
@@ -504,7 +509,7 @@
             return alias.get_destinations()
         if not self._is_other_address(alias.address, TYPE_ALIAS):
             raise VMMError(_(u"The alias '%s' doesn't exist.") %
-                           alias.address, ERR.NO_SUCH_ALIAS)
+                           alias.address, NO_SUCH_ALIAS)
 
     def aliasDelete(self, aliasaddress, targetaddress=None):
         """Deletes the `Alias` *aliasaddress* with all its destinations from
@@ -520,12 +525,12 @@
         """Wrapper around Account.get_info(...)"""
         if details not in (None, 'du', 'aliases', 'full'):
             raise VMMError(_(u"Invalid argument: '%s'") % details,
-                           ERR.INVALID_AGUMENT)
+                           INVALID_ARGUMENT)
         acc = self.__getAccount(emailaddress)
         if not acc:
             if not self._is_other_address(acc.address, TYPE_ACCOUNT):
                 raise VMMError(_(u"The account '%s' doesn't exist.") %
-                               acc.address, ERR.NO_SUCH_ACCOUNT)
+                               acc.address, NO_SUCH_ACCOUNT)
         info = acc.get_info()
         if self._Cfg.dget('account.disk_usage') or details in ('du', 'full'):
             path = os.path.join(acc.home, acc.mail_location.directory)
@@ -547,55 +552,55 @@
         """Wrapper for Account.modify('password' ...)."""
         if not isinstance(password, basestring) or not password:
             raise VMMError(_(u"Could not accept password: '%s'") % password,
-                           ERR.INVALID_AGUMENT)
+                           INVALID_ARGUMENT)
         acc = self.__getAccount(emailaddress)
         if not acc:
             raise VMMError(_(u"The account '%s' doesn't exist.") %
-                           acc.address, ERR.NO_SUCH_ACCOUNT)
+                           acc.address, NO_SUCH_ACCOUNT)
         acc.modify('password', password)
 
     def user_name(self, emailaddress, name):
         """Wrapper for Account.modify('name', ...)."""
         if not isinstance(name, basestring) or not name:
             raise VMMError(_(u"Could not accept name: '%s'") % name,
-                           ERR.INVALID_AGUMENT)
+                           INVALID_ARGUMENT)
         acc = self.__getAccount(emailaddress)
         if not acc:
             raise VMMError(_(u"The account '%s' doesn't exist.") %
-                           acc.address, ERR.NO_SUCH_ACCOUNT)
+                           acc.address, NO_SUCH_ACCOUNT)
         acc.modify('name', name)
 
     def user_transport(self, emailaddress, transport):
         """Wrapper for Account.modify('transport', ...)."""
         if not isinstance(transport, basestring) or not transport:
             raise VMMError(_(u"Could not accept transport: '%s'") % transport,
-                           ERR.INVALID_AGUMENT)
+                           INVALID_ARGUMENT)
         acc = self.__getAccount(emailaddress)
         if not acc:
             raise VMMError(_(u"The account '%s' doesn't exist.") %
-                           acc.address, ERR.NO_SUCH_ACCOUNT)
+                           acc.address, NO_SUCH_ACCOUNT)
         acc.modify('transport', transport)
 
     def user_disable(self, emailaddress, service=None):
         """Wrapper for Account.disable(service)"""
         if service not in (None, 'all', 'imap', 'pop3', 'smtp', 'sieve'):
             raise VMMError(_(u"Could not accept service: '%s'") % service,
-                           ERR.INVALID_AGUMENT)
+                           INVALID_ARGUMENT)
         acc = self.__getAccount(emailaddress)
         if not acc:
             raise VMMError(_(u"The account '%s' doesn't exist.") %
-                           acc.address, ERR.NO_SUCH_ACCOUNT)
+                           acc.address, NO_SUCH_ACCOUNT)
         acc.disable(service)
 
     def user_enable(self, emailaddress, service=None):
         """Wrapper for Account.enable(service)"""
         if service not in (None, 'all', 'imap', 'pop3', 'smtp', 'sieve'):
             raise VMMError(_(u"Could not accept service: '%s'") % service,
-                           ERR.INVALID_AGUMENT)
+                           INVALID_ARGUMENT)
         acc = self.__getAccount(emailaddress)
         if not acc:
             raise VMMError(_(u"The account '%s' doesn't exist.") %
-                           acc.address, ERR.NO_SUCH_ACCOUNT)
+                           acc.address, NO_SUCH_ACCOUNT)
         acc.enable(service)
 
     def relocatedAdd(self, emailaddress, targetaddress):
@@ -613,7 +618,7 @@
             return relocated.get_info()
         if not self._is_other_address(relocated.address, TYPE_RELOCATED):
             raise VMMError(_(u"The relocated user '%s' doesn't exist.") %
-                           relocated.address, ERR.NO_SUCH_RELOCATED)
+                           relocated.address, NO_SUCH_RELOCATED)
 
     def relocatedDelete(self, emailaddress):
         """Deletes the relocated user with the given *emailaddress* from
--- a/VirtualMailManager/Relocated.py	Mon Jul 26 16:08:15 2010 +0000
+++ b/VirtualMailManager/Relocated.py	Mon Jul 26 19:10:51 2010 +0000
@@ -11,7 +11,7 @@
 from VirtualMailManager.Domain import get_gid
 from VirtualMailManager.EmailAddress import EmailAddress
 from VirtualMailManager.errors import RelocatedError as RErr
-from VirtualMailManager.constants.ERROR import NO_SUCH_DOMAIN, \
+from VirtualMailManager.constants import NO_SUCH_DOMAIN, \
      NO_SUCH_RELOCATED, RELOCATED_ADDR_DEST_IDENTICAL, RELOCATED_EXISTS
 
 
--- a/VirtualMailManager/Transport.py	Mon Jul 26 16:08:15 2010 +0000
+++ b/VirtualMailManager/Transport.py	Mon Jul 26 19:10:51 2010 +0000
@@ -10,7 +10,7 @@
     domains and accounts.
 """
 
-from VirtualMailManager.constants.ERROR import UNKNOWN_TRANSPORT_ID
+from VirtualMailManager.constants import UNKNOWN_TRANSPORT_ID
 from VirtualMailManager.errors import TransportError
 from VirtualMailManager.pycompat import any
 
--- a/VirtualMailManager/__init__.py	Mon Jul 26 16:08:15 2010 +0000
+++ b/VirtualMailManager/__init__.py	Mon Jul 26 19:10:51 2010 +0000
@@ -11,8 +11,7 @@
 import gettext
 import locale
 
-from VirtualMailManager.constants.version import __author__, __date__, \
-     __version__
+from VirtualMailManager.constants import __author__, __date__, __version__
 
 __all__ = [
     # version information from VERSION
--- a/VirtualMailManager/cli/Config.py	Mon Jul 26 16:08:15 2010 +0000
+++ b/VirtualMailManager/cli/Config.py	Mon Jul 26 19:10:51 2010 +0000
@@ -16,7 +16,7 @@
 from VirtualMailManager.Config import Config, ConfigValueError, LazyConfig
 from VirtualMailManager.errors import ConfigError
 from VirtualMailManager.cli import w_err, w_std
-from VirtualMailManager.constants.ERROR import VMM_TOO_MANY_FAILURES
+from VirtualMailManager.constants import VMM_TOO_MANY_FAILURES
 
 _ = lambda msg: msg
 
--- a/VirtualMailManager/cli/Handler.py	Mon Jul 26 16:08:15 2010 +0000
+++ b/VirtualMailManager/cli/Handler.py	Mon Jul 26 19:10:51 2010 +0000
@@ -14,7 +14,7 @@
 from VirtualMailManager.Handler import Handler
 from VirtualMailManager.cli import read_pass
 from VirtualMailManager.cli.Config import CliConfig as Cfg
-from VirtualMailManager.constants.ERROR import INVALID_SECTION
+from VirtualMailManager.constants import INVALID_SECTION
 
 _ = lambda msg: msg
 
--- a/VirtualMailManager/cli/__init__.py	Mon Jul 26 16:08:15 2010 +0000
+++ b/VirtualMailManager/cli/__init__.py	Mon Jul 26 19:10:51 2010 +0000
@@ -16,7 +16,7 @@
 from termios import TIOCGWINSZ
 
 from VirtualMailManager import ENCODING
-from VirtualMailManager.constants.ERROR import VMM_TOO_MANY_FAILURES
+from VirtualMailManager.constants import VMM_TOO_MANY_FAILURES
 from VirtualMailManager.errors import VMMError
 
 
--- a/VirtualMailManager/common.py	Mon Jul 26 16:08:15 2010 +0000
+++ b/VirtualMailManager/common.py	Mon Jul 26 19:10:51 2010 +0000
@@ -12,7 +12,7 @@
 import re
 
 from VirtualMailManager import ENCODING
-from VirtualMailManager.constants.ERROR import \
+from VirtualMailManager.constants import \
      NOT_EXECUTABLE, NO_SUCH_BINARY, NO_SUCH_DIRECTORY
 from VirtualMailManager.errors import VMMError
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/VirtualMailManager/constants.py	Mon Jul 26 19:10:51 2010 +0000
@@ -0,0 +1,84 @@
+# -*- coding: UTF-8 -*-
+# Copyright (c) 2007 - 2010, Pascal Volk
+# See COPYING for distribution information.
+"""
+    VirtualMailManager.constants
+    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+    VirtualMailManager's constants:
+        * version information
+        * exit codes
+        * error codes
+"""
+# version information
+
+__all__ = ['__author__', '__date__', '__version__']
+AUTHOR = 'Pascal Volk <neverseen@users.sourceforge.net>'
+RELDATE = '2009-09-09'
+VERSION = '0.5.2'
+__author__ = AUTHOR
+__date__ = RELDATE
+__version__ = VERSION
+
+
+# exit codes
+
+EX_SUCCESS = 0
+EX_MISSING_ARGS = 1
+EX_UNKNOWN_COMMAND = 2
+EX_USER_INTERRUPT = 3
+
+
+# error codes
+
+ACCOUNT_AND_ALIAS_PRESENT = 20
+ACCOUNT_EXISTS = 21
+ACCOUNT_MISSING_PASSWORD = 69
+ACCOUNT_PRESENT = 22
+ALIASDOMAIN_EXISTS = 23
+ALIASDOMAIN_ISDOMAIN = 24
+ALIASDOMAIN_NO_DOMDEST = 25
+ALIAS_ADDR_DEST_IDENTICAL = 26
+ALIAS_EXCEEDS_EXPANSION_LIMIT = 27
+ALIAS_EXISTS = 28
+ALIAS_MISSING_DEST = 29
+ALIAS_PRESENT = 30
+CONF_ERROR = 31
+CONF_NOFILE = 32
+CONF_NOPERM = 33
+CONF_WRONGPERM = 34
+DATABASE_ERROR = 35
+DOMAINDIR_GROUP_MISMATCH = 36
+DOMAIN_ALIAS_EXISTS = 37
+DOMAIN_EXISTS = 38
+DOMAIN_INVALID = 39
+DOMAIN_NO_NAME = 40
+DOMAIN_TOO_LONG = 41
+FOUND_DOTS_IN_PATH = 42
+INVALID_ADDRESS = 43
+INVALID_ARGUMENT = 44
+INVALID_MAIL_LOCATION = 70
+INVALID_OPTION = 45
+INVALID_SECTION = 46
+LOCALPART_INVALID = 47
+LOCALPART_TOO_LONG = 48
+MAILDIR_PERM_MISMATCH = 49
+MAILLOCATION_INIT = 50
+NOT_EXECUTABLE = 51
+NO_SUCH_ACCOUNT = 52
+NO_SUCH_ALIAS = 53
+NO_SUCH_ALIASDOMAIN = 54
+NO_SUCH_BINARY = 55
+NO_SUCH_DIRECTORY = 56
+NO_SUCH_DOMAIN = 57
+NO_SUCH_RELOCATED = 58
+RELOCATED_ADDR_DEST_IDENTICAL = 59
+RELOCATED_EXISTS = 60
+RELOCATED_MISSING_DEST = 61
+TRANSPORT_INIT = 62
+UNKNOWN_MAILLOCATION_ID = 63
+UNKNOWN_MAILLOCATION_NAME = 64
+UNKNOWN_SERVICE = 65
+UNKNOWN_TRANSPORT_ID = 66
+VMM_ERROR = 67
+VMM_TOO_MANY_FAILURES = 68
--- a/VirtualMailManager/constants/ERROR.py	Mon Jul 26 16:08:15 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +0,0 @@
-# -*- coding: UTF-8 -*-
-# Copyright (c) 2007 - 2010, Pascal Volk
-# See COPYING for distribution information.
-
-ACCOUNT_AND_ALIAS_PRESENT = 20
-ACCOUNT_EXISTS = 21
-ACCOUNT_MISSING_PASSWORD = 69
-ACCOUNT_PRESENT = 22
-ALIASDOMAIN_EXISTS = 23
-ALIASDOMAIN_ISDOMAIN = 24
-ALIASDOMAIN_NO_DOMDEST = 25
-ALIAS_ADDR_DEST_IDENTICAL = 26
-ALIAS_EXCEEDS_EXPANSION_LIMIT = 27
-ALIAS_EXISTS = 28
-ALIAS_MISSING_DEST = 29
-ALIAS_PRESENT = 30
-CONF_ERROR = 31
-CONF_NOFILE = 32
-CONF_NOPERM = 33
-CONF_WRONGPERM = 34
-DATABASE_ERROR = 35
-DOMAINDIR_GROUP_MISMATCH = 36
-DOMAIN_ALIAS_EXISTS = 37
-DOMAIN_EXISTS = 38
-DOMAIN_INVALID = 39
-DOMAIN_NO_NAME = 40
-DOMAIN_TOO_LONG = 41
-FOUND_DOTS_IN_PATH = 42
-INVALID_ADDRESS = 43
-INVALID_AGUMENT = 44
-INVALID_MAIL_LOCATION = 70
-INVALID_OPTION = 45
-INVALID_SECTION = 46
-LOCALPART_INVALID = 47
-LOCALPART_TOO_LONG = 48
-MAILDIR_PERM_MISMATCH = 49
-MAILLOCATION_INIT = 50
-NOT_EXECUTABLE = 51
-NO_SUCH_ACCOUNT = 52
-NO_SUCH_ALIAS = 53
-NO_SUCH_ALIASDOMAIN = 54
-NO_SUCH_BINARY = 55
-NO_SUCH_DIRECTORY = 56
-NO_SUCH_DOMAIN = 57
-NO_SUCH_RELOCATED = 58
-RELOCATED_ADDR_DEST_IDENTICAL = 59
-RELOCATED_EXISTS = 60
-RELOCATED_MISSING_DEST = 61
-TRANSPORT_INIT = 62
-UNKNOWN_MAILLOCATION_ID = 63
-UNKNOWN_MAILLOCATION_NAME = 64
-UNKNOWN_SERVICE = 65
-UNKNOWN_TRANSPORT_ID = 66
-VMM_ERROR = 67
-VMM_TOO_MANY_FAILURES = 68
--- a/VirtualMailManager/constants/EXIT.py	Mon Jul 26 16:08:15 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-# -*- coding: UTF-8 -*-
-# Copyright (c) 2007 - 2010, Pascal Volk
-# See COPYING for distribution information.
-
-MISSING_ARGS = 1
-UNKNOWN_COMMAND = 2
-USER_INTERRUPT = 3
--- a/VirtualMailManager/constants/__init__.py	Mon Jul 26 16:08:15 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,6 +0,0 @@
-# -*- coding: UTF-8 -*-
-# Copyright (c) 2007 - 2010, Pascal Volk
-# See COPYING for distribution information.
-# package placeholder
-#
-# EOF
--- a/VirtualMailManager/constants/version.py	Mon Jul 26 16:08:15 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,17 +0,0 @@
-# -*- coding: UTF-8 -*-
-# Copyright (c) 2007 - 2010, Pascal Volk
-# See COPYING for distribution information.
-
-"""
-    VirtualMailManager.constants.version
-
-    VirtualMailManager's versions information.
-"""
-
-__all__ = ['__author__', '__date__', '__version__']
-AUTHOR = 'Pascal Volk <neverseen@users.sourceforge.net>'
-RELDATE = '2009-09-09'
-VERSION = '0.5.2'
-__author__ = AUTHOR
-__date__ = RELDATE
-__version__ = VERSION
--- a/VirtualMailManager/ext/Postconf.py	Mon Jul 26 16:08:15 2010 +0000
+++ b/VirtualMailManager/ext/Postconf.py	Mon Jul 26 19:10:51 2010 +0000
@@ -17,7 +17,7 @@
 from subprocess import Popen, PIPE
 
 from VirtualMailManager.errors import VMMError
-from VirtualMailManager.constants.ERROR import VMM_ERROR
+from VirtualMailManager.constants import VMM_ERROR
 
 _ = lambda msg: msg
 
--- a/VirtualMailManager/mailbox.py	Mon Jul 26 16:08:15 2010 +0000
+++ b/VirtualMailManager/mailbox.py	Mon Jul 26 19:10:51 2010 +0000
@@ -18,7 +18,7 @@
 from VirtualMailManager.Account import Account
 from VirtualMailManager.common import is_dir
 from VirtualMailManager.errors import VMMError
-from VirtualMailManager.constants.ERROR import VMM_ERROR
+from VirtualMailManager.constants import VMM_ERROR
 
 
 __all__ = ('new', 'Maildir', 'SingleDbox', 'MultiDbox',
--- a/VirtualMailManager/maillocation.py	Mon Jul 26 16:08:15 2010 +0000
+++ b/VirtualMailManager/maillocation.py	Mon Jul 26 19:10:51 2010 +0000
@@ -11,7 +11,7 @@
 
 """
 
-from VirtualMailManager.constants.ERROR import \
+from VirtualMailManager.constants import \
      MAILLOCATION_INIT, UNKNOWN_MAILLOCATION_ID
 from VirtualMailManager.errors import MailLocationError as MLErr
 from VirtualMailManager.pycompat import all
--- a/VirtualMailManager/password.py	Mon Jul 26 16:08:15 2010 +0000
+++ b/VirtualMailManager/password.py	Mon Jul 26 19:10:51 2010 +0000
@@ -26,7 +26,7 @@
 from VirtualMailManager import ENCODING
 from VirtualMailManager.EmailAddress import EmailAddress
 from VirtualMailManager.common import get_unicode, version_str
-from VirtualMailManager.constants.ERROR import VMM_ERROR
+from VirtualMailManager.constants import VMM_ERROR
 from VirtualMailManager.errors import VMMError
 
 COMPAT = hasattr(hashlib, 'compat')