PEP-8-ified the work of the last days. v0.6.x
authorPascal Volk <neverseen@users.sourceforge.net>
Thu, 25 Feb 2010 17:56:08 +0000
branchv0.6.x
changeset 215 33f727efa7c4
parent 214 84e6e898e6c5
child 216 0c8c053b451c
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.
VirtualMailManager/Alias.py
VirtualMailManager/Config.py
VirtualMailManager/EmailAddress.py
VirtualMailManager/Handler.py
VirtualMailManager/Relocated.py
VirtualMailManager/__init__.py
VirtualMailManager/cli/Config.py
VirtualMailManager/cli/__init__.py
VirtualMailManager/constants/VERSION.py
VirtualMailManager/constants/version.py
doc/source/vmm.rst
doc/source/vmm_config.rst
doc/source/vmm_relocated.rst
--- a/VirtualMailManager/Alias.py	Wed Feb 24 05:48:15 2010 +0000
+++ b/VirtualMailManager/Alias.py	Thu Feb 25 17:56:08 2010 +0000
@@ -68,9 +68,11 @@
                         ALIAS_EXCEEDS_EXPANSION_LIMIT)
 
     def __delete(self, destination=None):
-        """Deletes a destination from the alias, if ``destination`` is not
-        ``None``. If ``destination`` is None, the alias with all it's
-        destination addresses will be deleted."""
+        """Deletes a destination from the alias, if ``destination`` is
+        not ``None``.  If ``destination`` is None, the alias with all
+        it's destination addresses will be deleted.
+
+        """
         dbc = self._dbh.cursor()
         if not destination:
             dbc.execute("DELETE FROM alias WHERE gid=%s AND address=%s",
@@ -87,7 +89,7 @@
         """Returns the number of destinations of the alias."""
         return len(self._dests)
 
-    def addDestination(self, destination, expansion_limit):
+    def add_destination(self, destination, expansion_limit):
         """Adds the ``destination`` `EmailAddress` to the alias."""
         assert isinstance(destination, EmailAddress)
         if self._addr == destination:
@@ -107,7 +109,7 @@
         dbc.close()
         self._dests.append(destination)
 
-    def delDestination(self, destination):
+    def del_destination(self, destination):
         """Deletes the specified ``destination`` address from the alias."""
         assert isinstance(destination, EmailAddress)
         if not self._dests:
@@ -121,7 +123,7 @@
         self.__delete(destination)
         self._dests.remove(destination)
 
-    def getDestinations(self):
+    def get_destinations(self):
         """Returns an iterator for all destinations of the alias."""
         if not self._dests:
             raise VMMAE(_(u"The alias %r doesn't exist.") % str(self._addr),
--- a/VirtualMailManager/Config.py	Wed Feb 24 05:48:15 2010 +0000
+++ b/VirtualMailManager/Config.py	Thu Feb 25 17:56:08 2010 +0000
@@ -19,6 +19,9 @@
 from VirtualMailManager.Exceptions import VMMConfigException
 
 
+_ = lambda msg: msg
+
+
 class BadOptionError(Error):
     """Raised when a option isn't in the format 'section.option'."""
     pass
@@ -50,20 +53,21 @@
       `LazyConfig._cfg['sectionname']['optionname'].default`, if the
       option is not configured in a ini-like configuration file.
 
-    `set()` differs from `RawConfigParser`'s `set()` method. `set()` takes
-    the `section` and `option` arguments combined to a single string in the
-    form "section.option".
+    `set()` differs from `RawConfigParser`'s `set()` method. `set()`
+    takes the `section` and `option` arguments combined to a single
+    string in the form "section.option".
+
     """
 
     def __init__(self):
         RawConfigParser.__init__(self)
         self._modified = False
+        # sample _cfg dict.  Create your own in your derived class.
         self._cfg = {
             'sectionname': {
-                'optionname': LazyConfigOption(int, 1, self.getint)
+                'optionname': LazyConfigOption(int, 1, self.getint),
             }
         }
-        """sample _cfg dictionary. Create your own in your derived class."""
 
     def bool_new(self, value):
         """Converts the string `value` into a `bool` and returns it.
@@ -82,35 +86,38 @@
                                    get_unicode(value))
 
     def getboolean(self, section, option):
-        """Returns the boolean value of the option, in the given section.
+        """Returns the boolean value of the option, in the given
+        section.
 
         For a boolean True, the value must be set to '1', 'on', 'yes',
         'true' or True. For a boolean False, the value must set to '0',
         'off', 'no', 'false' or False.
-        If the option has another value assigned this method will raise a
-        ValueError.
+        If the option has another value assigned this method will raise
+        a ValueError.
+
         """
         # if the setting was modified it may be still a boolean value lets see
         tmp = self.get(section, option)
         if isinstance(tmp, bool):
             return tmp
         if not tmp.lower() in self._boolean_states:
-            raise ValueError, 'Not a boolean: %s' % tmp
+            raise ValueError('Not a boolean: %s' % tmp)
         return self._boolean_states[tmp.lower()]
 
     def _get_section_option(self, section_option):
-        """splits ``section_option`` (section\ **.**\ option) in two parts
-        and returns them as list ``[section, option]``, if:
+        """splits ``section_option`` (section.option) in two parts and
+        returns them as list ``[section, option]``, if:
 
-            * it likes the format of ``section_option``
-            * the ``section`` is known
-            * the ``option`` is known
+          * it likes the format of ``section_option``
+          * the ``section`` is known
+          * the ``option`` is known
 
         Else one of the following exceptions will be thrown:
 
-            * `BadOptionError`
-            * `NoSectionError`
-            * `NoOptionError`
+          * `BadOptionError`
+          * `NoSectionError`
+          * `NoOptionError`
+
         """
         sect_opt = section_option.lower().split('.')
         # TODO: cache it
@@ -125,22 +132,24 @@
         return sect_opt
 
     def items(self, section):
-        """returns an iterable that returns key, value ``tuples`` from the
-        given ``section``."""
+        """returns an iterable that returns key, value ``tuples`` from
+        the given ``section``.
+
+        """
         if section in self._sections:# check if the section was parsed
-            d2 = self._sections[section]
+            sect = self._sections[section]
         elif not section in self._cfg:
             raise NoSectionError(section)
         else:
             return ((k, self._cfg[section][k].default) \
                     for k in self._cfg[section].iterkeys())
         # still here? Get defaults and merge defaults with configured setting
-        d = dict((k, self._cfg[section][k].default) \
-                 for k in self._cfg[section].iterkeys())
-        d.update(d2)
-        if '__name__' in d:
-            del d['__name__']
-        return d.iteritems()
+        defaults = dict((k, self._cfg[section][k].default) \
+                        for k in self._cfg[section].iterkeys())
+        defaults.update(sect)
+        if '__name__' in defaults:
+            del defaults['__name__']
+        return defaults.iteritems()
 
     def dget(self, option):
         """Returns the value of the `option`.
@@ -152,11 +161,11 @@
         Arguments:
 
         `option` : string
-            the configuration option in the form
-            "``section``\ **.**\ ``option``"
+            the configuration option in the form "section.option"
 
         Throws a `NoDefaultError`, if no default value was passed to
         `LazyConfigOption.__init__()` for the `option`.
+
         """
         section, option = self._get_section_option(option)
         try:
@@ -176,7 +185,9 @@
         """Set the `value` of the `option`.
 
         Throws a `ValueError` if `value` couldn't be converted using
-        `LazyConfigOption.cls`"""
+        `LazyConfigOption.cls`.
+
+        """
         section, option = self._get_section_option(option)
         val = self._cfg[section][option].cls(value)
         if self._cfg[section][option].validate:
@@ -191,8 +202,10 @@
         return section.lower() in self._cfg
 
     def has_option(self, option):
-        """Checks if the option (section.option) is a known configuration
-        option."""
+        """Checks if the option (section.option) is a known
+        configuration option.
+
+        """
         try:
             self._get_section_option(option)
             return True
@@ -210,6 +223,7 @@
     `LazyConfigOption` instances are required by `LazyConfig` instances,
     and instances of classes derived from `LazyConfig`, like the
     `Config` class.
+
     """
     __slots__ = ('__cls', '__default', '__getter', '__validate')
 
@@ -221,14 +235,15 @@
         `cls` : type
           The class/type of the option's value
         `default`
-          Default value of the option. Use ``None`` if the option should not
-          have a default value.
+          Default value of the option. Use ``None`` if the option should
+          not have a default value.
         `getter` : callable
-          A method's name of `RawConfigParser` and derived classes, to get a
-          option's value, e.g. `self.getint`.
+          A method's name of `RawConfigParser` and derived classes, to
+          get a option's value, e.g. `self.getint`.
         `validate` : NoneType or a callable
-          None or any method, that takes one argument, in order to check the
-          value, when `LazyConfig.set()` is called.
+          None or any method, that takes one argument, in order to
+          check the value, when `LazyConfig.set()` is called.
+
         """
         self.__cls = cls
         if not default is None:# enforce the type of the default value
@@ -246,7 +261,10 @@
 
     @property
     def cls(self):
-        """The class of the option's value e.g. `str`, `unicode` or `bool`"""
+        """The class of the option's value e.g. `str`, `unicode` or
+        `bool`.
+
+        """
         return self.__cls
 
     @property
@@ -275,10 +293,11 @@
 
         `filename` : str
           path to the configuration file
+
         """
         LazyConfig.__init__(self)
-        self._cfgFileName = filename
-        self._cfgFile = None
+        self._cfg_filename = filename
+        self._cfg_file = None
         self.__missing = {}
 
         LCO = LazyConfigOption
@@ -286,75 +305,76 @@
         self._cfg = {
             'account': {
                 'delete_directory': LCO(bool_t, False, self.getboolean),
-                'directory_mode':   LCO(int,    448,   self.getint),
-                'disk_usage':       LCO(bool_t, False, self.getboolean),
-                'password_length':  LCO(int,    8,     self.getint),
-                'random_password':  LCO(bool_t, False, self.getboolean),
-                'imap' :            LCO(bool_t, True,  self.getboolean),
-                'pop3' :            LCO(bool_t, True,  self.getboolean),
-                'sieve':            LCO(bool_t, True,  self.getboolean),
-                'smtp' :            LCO(bool_t, True,  self.getboolean),
+                'directory_mode': LCO(int, 448, self.getint),
+                'disk_usage': LCO(bool_t, False, self.getboolean),
+                'password_length': LCO(int, 8, self.getint),
+                'random_password': LCO(bool_t, False, self.getboolean),
+                'imap': LCO(bool_t, True, self.getboolean),
+                'pop3': LCO(bool_t, True, self.getboolean),
+                'sieve': LCO(bool_t, True, self.getboolean),
+                'smtp': LCO(bool_t, True, self.getboolean),
             },
             'bin': {
-                'dovecotpw': LCO(str, '/usr/sbin/dovecotpw', self.get, exec_ok),
-                'du':        LCO(str, '/usr/bin/du',        self.get, exec_ok),
-                'postconf':  LCO(str, '/usr/sbin/postconf', self.get, exec_ok),
+                'dovecotpw': LCO(str, '/usr/sbin/dovecotpw', self.get,
+                                 exec_ok),
+                'du': LCO(str, '/usr/bin/du', self.get, exec_ok),
+                'postconf': LCO(str, '/usr/sbin/postconf', self.get, exec_ok),
             },
             'database': {
                 'host': LCO(str, 'localhost', self.get),
-                'name': LCO(str, 'mailsys',   self.get),
-                'pass': LCO(str, None,        self.get),
-                'user': LCO(str, None,        self.get),
+                'name': LCO(str, 'mailsys', self.get),
+                'pass': LCO(str, None, self.get),
+                'user': LCO(str, None, self.get),
             },
             'domain': {
-                'auto_postmaster':  LCO(bool_t, True,  self.getboolean),
+                'auto_postmaster': LCO(bool_t, True, self.getboolean),
                 'delete_directory': LCO(bool_t, False, self.getboolean),
-                'directory_mode':   LCO(int,    504,   self.getint),
-                'force_deletion':   LCO(bool_t, False, self.getboolean),
+                'directory_mode': LCO(int, 504, self.getint),
+                'force_deletion': LCO(bool_t, False, self.getboolean),
             },
             'maildir': {
                 'folders': LCO(str, 'Drafts:Sent:Templates:Trash', self.get),
-                'name':    LCO(str, 'Maildir',                     self.get),
+                'name': LCO(str, 'Maildir', self.get),
             },
             'misc': {
-                'base_directory':  LCO(str, '/srv/mail', self.get, is_dir),
-                'dovecot_version': LCO(int, 12,          self.getint),
-                'gid_mail':        LCO(int, 8,           self.getint),
-                'password_scheme': LCO(str, 'CRAM-MD5',  self.get,
+                'base_directory': LCO(str, '/srv/mail', self.get, is_dir),
+                'dovecot_version': LCO(int, 12, self.getint),
+                'gid_mail': LCO(int, 8, self.getint),
+                'password_scheme': LCO(str, 'CRAM-MD5', self.get,
                                        self.known_scheme),
-                'transport':       LCO(str, 'dovecot:',  self.get),
+                'transport': LCO(str, 'dovecot:', self.get),
             },
         }
 
-    def configure(self, sections):
-        raise NotImplementedError
-
     def load(self):
         """Loads the configuration, read only.
 
-        Raises a VMMConfigException if the configuration syntax is invalid.
+        Raises a VMMConfigException if the configuration syntax is
+        invalid.
+
         """
         try:
-            self._cfgFile = open(self._cfgFileName, 'r')
-            self.readfp(self._cfgFile)
-        except (MissingSectionHeaderError, ParsingError), e:
-            raise VMMConfigException(str(e), CONF_ERROR)
+            self._cfg_file = open(self._cfg_filename, 'r')
+            self.readfp(self._cfg_file)
+        except (MissingSectionHeaderError, ParsingError), err:
+            raise VMMConfigException(str(err), CONF_ERROR)
         finally:
-            if self._cfgFile and not self._cfgFile.closed:
-                self._cfgFile.close()
+            if self._cfg_file and not self._cfg_file.closed:
+                self._cfg_file.close()
 
     def check(self):
         """Performs a configuration check.
 
         Raises a VMMConfigException if the check fails.
+
         """
         # TODO: There are only two settings w/o defaults.
         #       So there is no need for cStringIO
-        if not self.__chkCfg():
+        if not self.__chk_cfg():
             errmsg = StringIO()
             errmsg.write(_(u'Missing options, which have no default value.\n'))
             errmsg.write(_(u'Using configuration file: %s\n') %
-                         self._cfgFileName)
+                         self._cfg_filename)
             for section, options in self.__missing.iteritems():
                 errmsg.write(_(u'* Section: %s\n') % section)
                 for option in options:
@@ -367,27 +387,36 @@
 
         Throws a `ConfigValueError` if the scheme is not listed in
         VirtualMailManager.SCHEMES.
+
         """
         scheme = scheme.upper()
         # TODO: VMM.SCHEMES
 
     def unicode(self, section, option):
-        """Returns the value of the `option` from `section`, converted to
-        Unicode."""
+        """Returns the value of the `option` from `section`, converted
+        to Unicode.
+
+        """
         return get_unicode(self.get(section, option))
 
-    def __chkCfg(self):
-        """Checks all section's options for settings w/o a default value.
+    def __chk_cfg(self):
+        """Checks all section's options for settings w/o a default
+        value.
 
-        Returns `True` if everything is fine, else `False`."""
+        Returns `True` if everything is fine, else `False`.
+
+        """
         errors = False
         for section in self._cfg.iterkeys():
             missing = []
             for option, value in self._cfg[section].iteritems():
                 if (value.default is None and
                     not RawConfigParser.has_option(self, section, option)):
-                        missing.append(option)
-                        errors = True
+                    missing.append(option)
+                    errors = True
             if missing:
                 self.__missing[section] = missing
         return not errors
+
+
+del _
--- a/VirtualMailManager/EmailAddress.py	Wed Feb 24 05:48:15 2010 +0000
+++ b/VirtualMailManager/EmailAddress.py	Thu Feb 25 17:56:08 2010 +0000
@@ -58,7 +58,7 @@
 
     def _chk_address(self, address):
         """Checks if the string ``address`` could be used for an e-mail
-        address. If so, it will assign the corresponding values to the
+        address.  If so, it will assign the corresponding values to the
         attributes `_localpart` and `_domainname`."""
         parts = address.split('@')
         p_len = len(parts)
--- a/VirtualMailManager/Handler.py	Wed Feb 24 05:48:15 2010 +0000
+++ b/VirtualMailManager/Handler.py	Thu Feb 25 17:56:08 2010 +0000
@@ -535,7 +535,7 @@
         the given *targetaddress*."""
         alias = self.__getAlias(aliasaddress)
         destination = EmailAddress(targetaddress)
-        alias.addDestination(destination,
+        alias.add_destination(destination,
                     long(self._postconf.read('virtual_alias_expansion_limit')))
         gid = self.__getDomain(destination.domainname).getID()
         if gid > 0 and (not Handler.accountExists(self._dbh, destination) and
@@ -573,7 +573,7 @@
         instances) for the `Alias` with the given *aliasaddress*."""
         alias = self.__getAlias(aliasaddress)
         try:
-            return alias.getDestinations()
+            return alias.get_destinations()
         except VMMAliasException, e:
             if e.code() == ERR.NO_SUCH_ALIAS:
                 if Handler.accountExists(self._dbh, alias._addr):
@@ -596,7 +596,7 @@
         if targetaddress is None:
             alias.delete()
         else:
-            alias.delDestination(EmailAddress(targetaddress))
+            alias.del_destination(EmailAddress(targetaddress))
 
     def userInfo(self, emailaddress, details=None):
         if details not in (None, 'du', 'aliases', 'full'):
@@ -660,13 +660,13 @@
         already a relocated user with the given *emailaddress*, only the
         *targetaddress* for the relocated user will be updated."""
         relocated = self.__getRelocated(emailaddress)
-        relocated.setDestination(EmailAddress(targetaddress))
+        relocated.set_destination(EmailAddress(targetaddress))
 
     def relocatedInfo(self, emailaddress):
         """Returns the target address of the relocated user with the given
         *emailaddress*."""
         relocated = self.__getRelocated(emailaddress)
-        return relocated.getInfo()
+        return relocated.get_info()
 
     def relocatedDelete(self, emailaddress):
         """Deletes the relocated user with the given *emailaddress* from
--- a/VirtualMailManager/Relocated.py	Wed Feb 24 05:48:15 2010 +0000
+++ b/VirtualMailManager/Relocated.py	Thu Feb 25 17:56:08 2010 +0000
@@ -23,11 +23,13 @@
     __slots__ = ('_addr', '_dest', '_gid', '_dbh')
 
     def __init__(self, dbh, address):
-        """Creates a new *Relocated* instance. The ``address`` is the
+        """Creates a new *Relocated* instance.  The ``address`` is the
         old e-mail address of the user.
 
         Use `setDestination()` to set/update the new address, where the
-        user has moved to."""
+        user has moved to.
+
+        """
         assert isinstance(address, EmailAddress)
         self._addr = address
         self._dbh = dbh
@@ -38,7 +40,9 @@
 
     def __load(self):
         """Loads the destination address from the database into the
-        `_dest` attribute."""
+        `_dest` attribute.
+
+        """
         dbc = self._dbh.cursor()
         dbc.execute(
             'SELECT destination FROM relocated WHERE gid=%s AND address=%s',
@@ -48,7 +52,7 @@
         if destination:
             self._dest = EmailAddress(destination[0])
 
-    def setDestination(self, destination):
+    def set_destination(self, destination):
         """Sets/updates the new address of the relocated user."""
         update = False
         assert isinstance(destination, EmailAddress)
@@ -76,7 +80,7 @@
         self._dbh.commit()
         dbc.close()
 
-    def getInfo(self):
+    def get_info(self):
         """Returns the address to which mails should be sent."""
         if not self._dest:
             raise VMMRE(_(u"The relocated user %r doesn't exist.") %
--- a/VirtualMailManager/__init__.py	Wed Feb 24 05:48:15 2010 +0000
+++ b/VirtualMailManager/__init__.py	Thu Feb 25 17:56:08 2010 +0000
@@ -18,13 +18,12 @@
 from VirtualMailManager.constants.ERROR import \
      DOMAIN_INVALID, DOMAIN_TOO_LONG, LOCALPART_INVALID, LOCALPART_TOO_LONG, \
      NOT_EXECUTABLE, NO_SUCH_BINARY, NO_SUCH_DIRECTORY
-from VirtualMailManager.constants.VERSION import *
+from VirtualMailManager.constants.version import __author__, __date__, \
+     __version__
 from VirtualMailManager.Exceptions import VMMException
 
 
 __all__ = [
-    # imported modules
-    'os', 're', 'locale',
     # version information from VERSION
     '__author__', '__date__', '__version__',
     # defined stuff
@@ -41,16 +40,14 @@
     locale.setlocale(locale.LC_ALL, 'C')
 ENCODING = locale.nl_langinfo(locale.CODESET)
 
-RE_DOMAIN = r"^(?:[a-z0-9-]{1,63}\.){1,}[a-z]{2,6}$"
-RE_LOCALPART = r"[^\w!#$%&'\*\+-\.\/=?^_`{\|}~]"
+# there may be many domain and e-mail address checks
+RE_DOMAIN = re.compile(r"^(?:[a-z0-9-]{1,63}\.){1,}[a-z]{2,6}$")
+RE_LOCALPART = re.compile(r"[^\w!#$%&'\*\+-\.\/=?^_`{\|}~]")
+
+gettext.install('vmm', '/usr/local/share/locale', unicode=1)
 
 
-# there may be many domain and e-mail address checks
-re_obj_domain = re.compile(RE_DOMAIN)
-re_obj_localpart = re.compile(RE_LOCALPART)
-
-
-gettext.install('vmm', '/usr/local/share/locale', unicode=1)
+_ = lambda msg: msg
 
 
 def get_unicode(string):
@@ -73,6 +70,7 @@
     """Checks if `path` is a directory.
 
     Throws a `VMMException` if `path` is not a directory.
+
     """
     path = expand_path(path)
     if not os.path.isdir(path):
@@ -86,6 +84,7 @@
 
     Throws a `VMMException` if the `binary` isn't a file or is not
     executable.
+
     """
     binary = expand_path(binary)
     if not os.path.isfile(binary):
@@ -110,16 +109,18 @@
 def check_domainname(domainname):
     """Returns the validated domain name `domainname`.
 
-    It also converts the name of the domain from IDN to ASCII, if necessary.
+    It also converts the name of the domain from IDN to ASCII, if
+    necessary.
 
-    Throws an `VMMException`, if the domain name is too long or doesn't look
-    like a valid domain name (label.label.label).
+    Throws an `VMMException`, if the domain name is too long or doesn't
+    look like a valid domain name (label.label.label).
+
     """
-    if not re_obj_domain.match(domainname):
+    if not RE_DOMAIN.match(domainname):
         domainname = idn2ascii(domainname)
     if len(domainname) > 255:
         raise VMMException(_(u'The domain name is too long'), DOMAIN_TOO_LONG)
-    if not re_obj_domain.match(domainname):
+    if not RE_DOMAIN.match(domainname):
         raise VMMException(_(u'The domain name %r is invalid') % domainname,
                            DOMAIN_INVALID)
     return domainname
@@ -130,11 +131,12 @@
 
     Throws a `VMMException` if the local-part is too long or contains
     invalid characters.
+
     """
     if len(localpart) > 64:
         raise VMMException(_(u'The local-part %r is too long') % localpart,
                            LOCALPART_TOO_LONG)
-    invalid_chars = set(re_obj_localpart.findall(localpart))
+    invalid_chars = set(RE_LOCALPART.findall(localpart))
     if invalid_chars:
         i_chars = u''.join((u'"%s" ' % c for c in invalid_chars))
         raise VMMException(_(u"The local-part %(l_part)r contains invalid \
@@ -142,3 +144,6 @@
                            {'l_part': localpart, 'i_chars': i_chars},
                            LOCALPART_INVALID)
     return localpart
+
+
+del _
--- a/VirtualMailManager/cli/Config.py	Wed Feb 24 05:48:15 2010 +0000
+++ b/VirtualMailManager/cli/Config.py	Thu Feb 25 17:56:08 2010 +0000
@@ -31,7 +31,7 @@
 [%(current_value)s]: ')
         failures = 0
 
-        w_std(_(u'Using configuration file: %s\n') % self._cfgFileName)
+        w_std(_(u'Using configuration file: %s\n') % self._cfg_filename)
         for s in sections:
             w_std(_(u'* Configuration section: %r') % s)
             for opt, val in self.items(s):
@@ -82,7 +82,7 @@
 
     def __saveChanges(self):
         """Writes changes to the configuration file."""
-        copy2(self._cfgFileName, self._cfgFileName + '.bak')
-        self._cfgFile = open(self._cfgFileName, 'w')
-        self.write(self._cfgFile)
-        self._cfgFile.close()
+        copy2(self._cfg_filename, self._cfg_filename + '.bak')
+        self._cfg_file = open(self._cfg_filename, 'w')
+        self.write(self._cfg_file)
+        self._cfg_file.close()
--- a/VirtualMailManager/cli/__init__.py	Wed Feb 24 05:48:15 2010 +0000
+++ b/VirtualMailManager/cli/__init__.py	Thu Feb 25 17:56:08 2010 +0000
@@ -8,16 +8,16 @@
     VirtualMailManager's command line interface.
 """
 
+import os
 from cStringIO import StringIO
 from getpass import getpass
 from textwrap import TextWrapper
 
-import VirtualMailManager
+from VirtualMailManager import ENCODING
 
 
 __all__ = ('get_winsize', 'read_pass', 'string_io', 'w_err', 'w_std')
 
-os = VirtualMailManager.os
 _std_write = os.sys.stdout.write
 _err_write = os.sys.stderr.write
 
@@ -26,7 +26,7 @@
     """Writes each arg of `args`, encoded in the current ENCODING, to stdout
     and appends a newline."""
     for arg in args:
-        _std_write(arg.encode(VirtualMailManager.ENCODING, 'replace'))
+        _std_write(arg.encode(ENCODING, 'replace'))
         _std_write('\n')
 
 
@@ -37,7 +37,7 @@
     This function additional interrupts the program execution and uses
     `code` system exit status."""
     for arg in args:
-        _err_write(arg.encode(VirtualMailManager.ENCODING, 'replace'))
+        _err_write(arg.encode(ENCODING, 'replace'))
         _err_write('\n')
     os.sys.exit(code)
 
--- a/VirtualMailManager/constants/VERSION.py	Wed Feb 24 05:48:15 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,11 +0,0 @@
-# -*- coding: UTF-8 -*-
-# Copyright (c) 2007 - 2010, Pascal Volk
-# See COPYING for distribution information.
-
-AUTHOR  = 'Pascal Volk <neverseen@users.sourceforge.net>'
-RELDATE = '2009-09-09'
-VERSION = '0.5.2'
-__author__  = AUTHOR
-__date__    = RELDATE
-__version__ = VERSION
-__all__ = ['__author__', '__date__', '__version__']
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/VirtualMailManager/constants/version.py	Thu Feb 25 17:56:08 2010 +0000
@@ -0,0 +1,17 @@
+# -*- 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/doc/source/vmm.rst	Wed Feb 24 05:48:15 2010 +0000
+++ b/doc/source/vmm.rst	Thu Feb 25 17:56:08 2010 +0000
@@ -24,18 +24,6 @@
   The systems current character encoding, e.g. ``'UTF-8'`` or
   ``'ANSI_X3.4-1968'`` (aka ASCII).
 
-.. data:: __author__
-
-  The author's name
-
-.. data:: __date__
-
-  The release date
-
-.. data:: __version__
-
-  VirtualMailManager's version
-
 
 Functions
 ---------
--- a/doc/source/vmm_config.rst	Wed Feb 24 05:48:15 2010 +0000
+++ b/doc/source/vmm_config.rst	Thu Feb 25 17:56:08 2010 +0000
@@ -49,10 +49,10 @@
               LCO = LazyConfigOption
               self._cfg = {
                   'database': {# section database:
-                      'host': LCO(str, '::1', self.get),# options of the
-                      'name': LCO(str, 'dbx', self.get),# database section.
-                      'pass': LCO(str, None,  self.get),# No defaults for the
-                      'user': LCO(str, None,  self.get),# user and pass options
+                      'host': LCO(str, '::1', self.get), # options of the
+                      'name': LCO(str, 'dbx', self.get), # database section.
+                      'pass': LCO(str, None, self.get),  # No defaults for the
+                      'user': LCO(str, None, self.get),  # user and pass options
                   }
               }
 
--- a/doc/source/vmm_relocated.rst	Wed Feb 24 05:48:15 2010 +0000
+++ b/doc/source/vmm_relocated.rst	Thu Feb 25 17:56:08 2010 +0000
@@ -20,9 +20,9 @@
 .. class:: Relocated(dbh, address)
 
   Creates a new *Relocated* instance. If the relocated user with the given
-  *address* is already stored in the database use :meth:`getInfo` to get the
+  *address* is already stored in the database use :meth:`get_info` to get the
   destination address of the relocated user. To set or update the destination
-  of the relocated user use :meth:`setDestination`. Use :meth:`delete` in
+  of the relocated user use :meth:`set_destination`. Use :meth:`delete` in
   order to delete the relocated user from the database.
   
   :param dbh: a database connection
@@ -40,7 +40,7 @@
     Deletes the relocated user from the database.
 
 
-  .. method:: getInfo()
+  .. method:: get_info()
 
     :rtype: :class:`VirtualMailManager.EmailAddress.EmailAddress`
     :raise VirtualMailManager.Exceptions.VMMRelocatedException: if the
@@ -49,7 +49,7 @@
     Returns the destination e-mail address of the relocated user.
 
 
-  .. method:: setDestination(destination)
+  .. method:: set_destination(destination)
 
     :param destination: the new address where the relocated user has moved to
     :type destination: :class:`VirtualMailManager.EmailAddress.EmailAddress`