VMM/…: re-indented long queries and error messages. v0.6.x
authorPascal Volk <neverseen@users.sourceforge.net>
Sun, 09 May 2010 06:20:52 +0000
branchv0.6.x
changeset 290 e2785e04f92e
parent 289 142f188f7552
child 291 7ef3f117a230
VMM/…: re-indented long queries and error messages.
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/cli/Config.py
VirtualMailManager/ext/Postconf.py
VirtualMailManager/password.py
--- a/VirtualMailManager/Account.py	Wed May 05 21:50:31 2010 +0000
+++ b/VirtualMailManager/Account.py	Sun May 09 06:20:52 2010 +0000
@@ -66,9 +66,8 @@
         """Load 'uid', 'mid' and 'tid' from the database and set _new to
         `False` - if the user could be found. """
         dbc = self._dbh.cursor()
-        dbc.execute(
-            "SELECT uid, mid, tid FROM users WHERE gid=%s AND local_part=%s",
-                    self._domain.gid, self._addr.localpart)
+        dbc.execute('SELECT uid, mid, tid FROM users WHERE gid = %s AND '
+                    'local_part = %s', self._domain.gid, self._addr.localpart)
         result = dbc.fetchone()
         dbc.close()
         if result:
@@ -90,16 +89,17 @@
         information in the database.
         """
         if maillocation.dovecot_version > cfg_dget('misc.dovecot_version'):
-            raise AErr(_("The mail_location prefix '%(prefix)s' requires \
-Dovecot >= v%(version)s") % {'prefix': maillocation.prefix,
-                       'version': version_str(maillocation.dovecot_version)},
+            raise AErr(_(u"The mail_location prefix '%(prefix)s' requires "
+                         u"Dovecot >= v%(version)s") %
+                       {'prefix': maillocation.prefix,
+                        'version': version_str(maillocation.dovecot_version)},
                        INVALID_MAIL_LOCATION)
         if not maillocation.postfix and \
           self._transport.transport.lower() in ('virtual:', 'virtual'):
-            raise AErr(_(u"Invalid transport '%(transport)s' for mail_location\
- prefix '%(prefix)s'") % {'transport': self._transport,
-                       'prefix': maillocation.prefix},
-                       INVALID_MAIL_LOCATION)
+            raise AErr(_(u"Invalid transport '%(transport)s' for mail_location"
+                         u" prefix '%(prefix)s'") %
+                       {'transport': self._transport,
+                        'prefix': maillocation.prefix}, INVALID_MAIL_LOCATION)
         self._mid = maillocation.mid
         self._set_uid()
 
@@ -323,17 +323,18 @@
             info['uid'] = self._uid
             return info
         # nearly impossible‽
-        raise AErr(_(u"Couldn't fetch information for account: '%s'") \
-                   % self._addr, NO_SUCH_ACCOUNT)
+        raise AErr(_(u"Couldn't fetch information for account: '%s'") %
+                   self._addr, NO_SUCH_ACCOUNT)
 
     def get_aliases(self):
         """Return a list with all alias e-mail addresses, whose destination
         is the address of the Account."""
         self._chk_state()
         dbc = self._dbh.cursor()
-        dbc.execute("SELECT address ||'@'|| domainname FROM alias, domain_name\
- WHERE destination = %s AND domain_name.gid = alias.gid\
- AND domain_name.is_primary ORDER BY address", str(self._addr))
+        dbc.execute("SELECT address ||'@'|| domainname FROM alias, "
+                    "domain_name WHERE destination = %s AND domain_name.gid = "
+                    "alias.gid AND domain_name.is_primary ORDER BY address",
+                    str(self._addr))
         addresses = dbc.fetchall()
         dbc.close()
         aliases = []
@@ -365,8 +366,8 @@
             a_count = self._count_aliases()
             if a_count > 0:
                 dbc.close()
-                raise AErr(_(u"There are %(count)d aliases with the \
-destination address '%(address)s'.") % \
+                raise AErr(_(u"There are %(count)d aliases with the "
+                             u"destination address '%(address)s'.") %
                            {'count': a_count, 'address': self._addr},
                            ALIAS_PRESENT)
             dbc.execute('DELETE FROM users WHERE uid = %s', self._uid)
@@ -398,9 +399,10 @@
     if uid < 1:
         raise AErr(_(u'UID must be greater than 0.'), INVALID_AGUMENT)
     dbc = dbh.cursor()
-    dbc.execute("SELECT local_part||'@'|| domain_name.domainname AS address,\
- uid, users.gid FROM users LEFT JOIN domain_name ON (domain_name.gid \
- = users.gid AND is_primary) WHERE uid = %s;", uid)
+    dbc.execute("SELECT local_part||'@'|| domain_name.domainname AS address, "
+                "uid, users.gid FROM users LEFT JOIN domain_name ON "
+                "(domain_name.gid = users.gid AND is_primary) WHERE uid = %s",
+                uid)
     info = dbc.fetchone()
     dbc.close()
     if not info:
--- a/VirtualMailManager/Alias.py	Wed May 05 21:50:31 2010 +0000
+++ b/VirtualMailManager/Alias.py	Sun May 09 06:20:52 2010 +0000
@@ -40,9 +40,8 @@
     def __load_dests(self):
         """Loads all known destination addresses into the _dests list."""
         dbc = self._dbh.cursor()
-        dbc.execute(
-                'SELECT destination FROM alias WHERE gid=%s AND address=%s',
-                    self._gid, self._addr.localpart)
+        dbc.execute('SELECT destination FROM alias WHERE gid = %s AND '
+                    'address = %s', self._gid, self._addr.localpart)
         dests = iter(dbc.fetchall())
         if dbc.rowcount > 0:
             self._dests.extend(EmailAddress(dest[0]) for dest in dests)
@@ -81,12 +80,12 @@
         """
         dbc = self._dbh.cursor()
         if not destination:
-            dbc.execute("DELETE FROM alias WHERE gid=%s AND address=%s",
+            dbc.execute('DELETE FROM alias WHERE gid = %s AND address = %s',
                         self._gid, self._addr.localpart)
         else:
-            dbc.execute("DELETE FROM alias WHERE gid=%s AND address=%s AND \
- destination=%s",
-                        self._gid, self._addr.localpart, str(destination))
+            dbc.execute('DELETE FROM alias WHERE gid = %s AND address = %s '
+                        'AND destination = %s', self._gid,
+                        self._addr.localpart, str(destination))
         if dbc.rowcount > 0:
             self._dbh.commit()
         dbc.close()
@@ -141,10 +140,9 @@
             raise AErr(_(u"The alias '%s' doesn't exist.") % self._addr,
                        NO_SUCH_ALIAS)
         if not destination in self._dests:
-            raise AErr(_(u"The address '%(d)s' isn't a destination of \
-the alias '%(a)s'.") %
-                       {'a': self._addr, 'd': destination},
-                       NO_SUCH_ALIAS)
+            raise AErr(_(u"The address '%(addr)s' isn't a destination of "
+                         u"the alias '%(alias)s'.") % {'addr': self._addr,
+                       'alias': destination}, NO_SUCH_ALIAS)
         self.__delete(destination)
         self._dests.remove(destination)
 
--- a/VirtualMailManager/AliasDomain.py	Wed May 05 21:50:31 2010 +0000
+++ b/VirtualMailManager/AliasDomain.py	Sun May 09 06:20:52 2010 +0000
@@ -41,9 +41,8 @@
         """Loads the AliasDomain's GID from the database and checks if the
         domain name is marked as primary."""
         dbc = self._dbh.cursor()
-        dbc.execute(
-            'SELECT gid, is_primary FROM domain_name WHERE domainname = %s',
-                    self._name)
+        dbc.execute('SELECT gid, is_primary FROM domain_name WHERE '
+                    'domainname = %s', self._name)
         result = dbc.fetchone()
         dbc.close()
         if result:
@@ -89,17 +88,15 @@
             raise ADErr(_(u"The alias domain '%s' doesn't exist.") %
                         self._name, NO_SUCH_ALIASDOMAIN)
         dbc = self._dbh.cursor()
-        dbc.execute(
-            'SELECT domainname FROM domain_name WHERE gid = %s AND is_primary',
-                    self._gid)
+        dbc.execute('SELECT domainname FROM domain_name WHERE gid = %s AND '
+                    'is_primary', self._gid)
         domain = dbc.fetchone()
         dbc.close()
         if domain:
             return {'alias': self._name, 'domain': domain[0]}
         else:  # an almost unlikely case, isn't it?
-            raise ADErr(
-                   _(u"There is no primary domain for the alias domain '%s'.")\
-                        % self._name, NO_SUCH_DOMAIN)
+            raise ADErr(_(u'There is no primary domain for the alias domain '
+                          u"'%s'.") % self._name, NO_SUCH_DOMAIN)
 
     def switch(self):
         """Switch the destination of the AliasDomain to the new destination,
@@ -115,14 +112,14 @@
             raise ADErr(_(u"The alias domain '%s' doesn't exist.") %
                         self._name, NO_SUCH_ALIASDOMAIN)
         if self._gid == self._domain.gid:
-            raise ADErr(_(u"The alias domain '%(alias)s' is already assigned\
- to the domain '%(domain)s'.") %
+            raise ADErr(_(u"The alias domain '%(alias)s' is already assigned "
+                          u"to the domain '%(domain)s'.") %
                         {'alias': self._name, 'domain': self._domain.name},
                         ALIASDOMAIN_EXISTS)
         dbc = self._dbh.cursor()
-        dbc.execute('UPDATE domain_name SET gid = %s WHERE gid = %s\
- AND domainname = %s AND NOT is_primary',
-                    self._domain.gid, self._gid, self._name)
+        dbc.execute('UPDATE domain_name SET gid = %s WHERE gid = %s AND '
+                    'domainname = %s AND NOT is_primary', self._domain.gid,
+                    self._gid, self._name)
         self._dbh.commit()
         dbc.close()
         self._gid = self._domain.gid
@@ -136,9 +133,8 @@
             raise ADErr(_(u"The alias domain '%s' doesn't exist.") %
                         self._name, NO_SUCH_ALIASDOMAIN)
         dbc = self._dbh.cursor()
-        dbc.execute(
-            'DELETE FROM domain_name WHERE domainname = %s AND NOT is_primary',
-                    self._name)
+        dbc.execute('DELETE FROM domain_name WHERE domainname = %s AND NOT '
+                    'is_primary', self._name)
         if dbc.rowcount > 0:
             self._dbh.commit()
             self._gid = 0
--- a/VirtualMailManager/Config.py	Wed May 05 21:50:31 2010 +0000
+++ b/VirtualMailManager/Config.py	Sun May 09 06:20:52 2010 +0000
@@ -124,8 +124,8 @@
         sect_opt = section_option.lower().split('.')
         # TODO: cache it
         if len(sect_opt) != 2:  # do we need a regexp to check the format?
-            raise BadOptionError(
-                        _(u"Bad format: '%s' - expected: section.option") %
+            raise BadOptionError(_(u"Bad format: '%s' - expected: "
+                                   u"section.option") %
                                  get_unicode(section_option))
         if not sect_opt[0] in self._cfg:
             raise NoSectionError(sect_opt[0])
--- a/VirtualMailManager/Domain.py	Wed May 05 21:50:31 2010 +0000
+++ b/VirtualMailManager/Domain.py	Sun May 09 06:20:52 2010 +0000
@@ -63,9 +63,9 @@
         domain.
         """
         dbc = self._dbh.cursor()
-        dbc.execute('SELECT dd.gid, tid, domaindir, is_primary FROM \
- domain_data dd, domain_name dn WHERE domainname = %s AND dn.gid = dd.gid',
-                    self._name)
+        dbc.execute('SELECT dd.gid, tid, domaindir, is_primary FROM '
+                    'domain_data dd, domain_name dn WHERE domainname = %s AND '
+                    'dn.gid = dd.gid', self._name)
         result = dbc.fetchone()
         dbc.close()
         if result:
@@ -250,12 +250,10 @@
     def get_info(self):
         """Returns a dictionary with information about the domain."""
         self._chk_state()
-        sql = """SELECT gid, domainname, transport, domaindir, aliasdomains,
-       accounts, aliases, relocated
-  FROM vmm_domain_info
- WHERE gid = %i""" % self._gid
         dbc = self._dbh.cursor()
-        dbc.execute(sql)
+        dbc.execute('SELECT gid, domainname, transport, domaindir, '
+                    'aliasdomains accounts, aliases, relocated FROM '
+                    'vmm_domain_info WHERE gid = %s', self._gid)
         info = dbc.fetchone()
         dbc.close()
         keys = ('gid', 'domainname', 'transport', 'domaindir', 'aliasdomains',
@@ -266,12 +264,12 @@
         """Returns a list with all accounts of the domain."""
         self._chk_state()
         dbc = self._dbh.cursor()
-        dbc.execute("SELECT local_part from users where gid = %s ORDER BY\
- local_part", self._gid)
+        dbc.execute('SELECT local_part from users where gid = %s ORDER BY '
+                    'local_part', self._gid)
         users = dbc.fetchall()
         dbc.close()
         accounts = []
-        if len(users) > 0:
+        if users:
             addr = u'@'.join
             _dom = self._name
             accounts = [addr((account[0], _dom)) for account in users]
@@ -281,8 +279,8 @@
         """Returns a list with all aliases e-mail addresses of the domain."""
         self._chk_state()
         dbc = self._dbh.cursor()
-        dbc.execute("SELECT DISTINCT address FROM alias WHERE gid = %s\
- ORDER BY address", self._gid)
+        dbc.execute('SELECT DISTINCT address FROM alias WHERE gid = %s ORDER '
+                    'BY address', self._gid)
         addresses = dbc.fetchall()
         dbc.close()
         aliases = []
@@ -296,8 +294,8 @@
         """Returns a list with all addresses of relocated users."""
         self._chk_state()
         dbc = self._dbh.cursor()
-        dbc.execute("SELECT address FROM relocated WHERE gid = %s\
- ORDER BY address", self._gid)
+        dbc.execute('SELECT address FROM relocated WHERE gid = %s ORDER BY '
+                    'address', self._gid)
         addresses = dbc.fetchall()
         dbc.close()
         relocated = []
@@ -311,8 +309,8 @@
         """Returns a list with all alias domain names of the domain."""
         self._chk_state()
         dbc = self._dbh.cursor()
-        dbc.execute("SELECT domainname FROM domain_name WHERE gid = %s\
- AND NOT is_primary ORDER BY domainname", self._gid)
+        dbc.execute('SELECT domainname FROM domain_name WHERE gid = %s AND '
+                    'NOT is_primary ORDER BY domainname', self._gid)
         anames = dbc.fetchall()
         dbc.close()
         aliasdomains = []
--- a/VirtualMailManager/EmailAddress.py	Wed May 05 21:50:31 2010 +0000
+++ b/VirtualMailManager/EmailAddress.py	Sun May 09 06:20:52 2010 +0000
@@ -95,10 +95,9 @@
     invalid_chars = set(RE_LOCALPART.findall(localpart))
     if invalid_chars:
         i_chars = u''.join((u'"%s" ' % c for c in invalid_chars))
-        raise EAErr(_(u"The local-part '%(l_part)s' contains invalid \
-characters: %(i_chars)s") %
-                    {'l_part': localpart, 'i_chars': i_chars},
-                    LOCALPART_INVALID)
+        raise EAErr(_(u"The local-part '%(l_part)s' contains invalid "
+                      u"characters: %(i_chars)s") % {'l_part': localpart,
+                    'i_chars': i_chars}, LOCALPART_INVALID)
     return localpart
 
 
--- a/VirtualMailManager/Handler.py	Wed May 05 21:50:31 2010 +0000
+++ b/VirtualMailManager/Handler.py	Sun May 09 06:20:52 2010 +0000
@@ -70,7 +70,7 @@
 
         if os.geteuid():
             raise NotRootError(_(u"You are not root.\n\tGood bye!\n"),
-                ERR.CONF_NOPERM)
+                               ERR.CONF_NOPERM)
         if self.__chkCfgFile():
             self._Cfg = Cfg(self._cfgFileName)
             self._Cfg.load()
@@ -85,9 +85,8 @@
                 self._cfgFileName = tmp
                 break
         if not len(self._cfgFileName):
-            raise VMMError(
-                _(u"No “vmm.cfg” found in: /root:/usr/local/etc:/etc"),
-                ERR.CONF_NOFILE)
+            raise VMMError(_(u"No 'vmm.cfg' found in: "
+                             u"/root:/usr/local/etc:/etc"), ERR.CONF_NOFILE)
 
     def __chkCfgFile(self):
         """Checks the configuration file, returns bool"""
@@ -96,10 +95,10 @@
         fmode = int(oct(fstat.st_mode & 0777))
         if fmode % 100 and fstat.st_uid != fstat.st_gid or \
            fmode % 10 and fstat.st_uid == fstat.st_gid:
-            raise PermissionError(_(u"wrong permissions for '%(file)s': \
-%(perms)s\n`chmod 0600 %(file)s` would be great.") %
-                                  {'file': self._cfgFileName, 'perms': fmode},
-                                  ERR.CONF_WRONGPERM)
+            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)
         else:
             return True
 
@@ -112,23 +111,22 @@
             os.chown(basedir, 0, 0)
             os.umask(old_umask)
         elif not os.path.isdir(basedir):
-            raise VMMError(_(u'“%s” is not a directory.\n\
-(vmm.cfg: section "misc", option "base_directory")') %
-                                 basedir, ERR.NO_SUCH_DIRECTORY)
+            raise VMMError(_(u"'%s' is not a directory.\n(vmm.cfg: section "
+                             u"'misc', option 'base_directory')") % basedir,
+                           ERR.NO_SUCH_DIRECTORY)
         for opt, val in self._Cfg.items('bin'):
             try:
                 exec_ok(val)
-            except VMMError, e:
-                if e.code is ERR.NO_SUCH_BINARY:
-                    raise VMMError(_(u'“%(binary)s” doesn\'t exist.\n\
-(vmm.cfg: section "bin", option "%(option)s")') %
-                                       {'binary': val, 'option': opt},
-                                       ERR.NO_SUCH_BINARY)
-                elif e.code is ERR.NOT_EXECUTABLE:
-                    raise VMMError(_(u'“%(binary)s” is not executable.\
-\n(vmm.cfg: section "bin", option "%(option)s")') %
-                                       {'binary': val, 'option': opt},
-                                       ERR.NOT_EXECUTABLE)
+            except VMMError, err:
+                if err.code is ERR.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:
+                    raise VMMError(_(u"'%(binary)s' is not executable.\n"
+                                     u"(vmm.cfg: section 'bin', option "
+                                     u"'%(option)s')") % {'binary': val,
+                                   'option': opt}, err.code)
                 else:
                     raise
 
@@ -488,9 +486,8 @@
         if pattern and (pattern.startswith('%') or pattern.endswith('%')):
             like = True
             if not re.match(RE_DOMAIN_SEARCH, pattern.strip('%')):
-                raise VMMError(
-                        _(u"The pattern '%s' contains invalid characters.") %
-                               pattern, ERR.DOMAIN_INVALID)
+                raise VMMError(_(u"The pattern '%s' contains invalid "
+                                 u"characters.") % pattern, ERR.DOMAIN_INVALID)
         self.__dbConnect()
         return search(self._dbh, pattern=pattern, like=like)
 
@@ -514,10 +511,9 @@
             self.__warnings.extend(('  * %s' % w for w in warnings))
         for destination in destinations:
             if get_gid(self._dbh, destination.domainname) and \
-              not self._chk_other_address_types(destination, TYPE_RELOCATED):
-                self.__warnings.append(
-                    _(u"The destination account/alias '%s' doesn't exist.") %
-                                       destination)
+               not self._chk_other_address_types(destination, TYPE_RELOCATED):
+                self.__warnings.append(_(u"The destination account/alias '%s' "
+                                         u"doesn't exist.") % destination)
 
     def user_delete(self, emailaddress, force=None):
         """Wrapper around Account.delete(...)"""
@@ -643,7 +639,7 @@
     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,
+            raise VMMError(_(u"Could not accept service: '%s'") % service,
                            ERR.INVALID_AGUMENT)
         acc = self.__getAccount(emailaddress)
         if not acc:
--- a/VirtualMailManager/Relocated.py	Wed May 05 21:50:31 2010 +0000
+++ b/VirtualMailManager/Relocated.py	Sun May 09 06:20:52 2010 +0000
@@ -51,9 +51,8 @@
 
         """
         dbc = self._dbh.cursor()
-        dbc.execute(
-            'SELECT destination FROM relocated WHERE gid=%s AND address=%s',
-                    self._gid, self._addr.localpart)
+        dbc.execute('SELECT destination FROM relocated WHERE gid = %s AND '
+                    'address = %s', self._gid, self._addr.localpart)
         destination = dbc.fetchone()
         dbc.close()
         if destination:
@@ -86,9 +85,9 @@
             dbc.execute('INSERT INTO relocated VALUES (%s, %s, %s)',
                         self._gid, self._addr.localpart, str(self._dest))
         else:
-            dbc.execute('UPDATE relocated SET destination=%s \
-WHERE gid=%s AND address=%s',
-                        str(self._dest), self._gid, self._addr.localpart)
+            dbc.execute('UPDATE relocated SET destination = %s WHERE gid = %s '
+                        'AND address = %s', str(self._dest), self._gid,
+                        self._addr.localpart)
         self._dbh.commit()
         dbc.close()
 
@@ -105,7 +104,7 @@
             raise RErr(_(u"The relocated user '%s' doesn't exist.") %
                        self._addr, NO_SUCH_RELOCATED)
         dbc = self._dbh.cursor()
-        dbc.execute("DELETE FROM relocated WHERE gid = %s AND address = %s",
+        dbc.execute('DELETE FROM relocated WHERE gid = %s AND address = %s',
                     self._gid, self._addr.localpart)
         if dbc.rowcount > 0:
             self._dbh.commit()
--- a/VirtualMailManager/cli/Config.py	Wed May 05 21:50:31 2010 +0000
+++ b/VirtualMailManager/cli/Config.py	Sun May 09 06:20:52 2010 +0000
@@ -27,8 +27,8 @@
     def configure(self, sections):
         """Interactive method for configuring all options of the given
         iterable ``sections`` object."""
-        input_fmt = _(u'Enter new value for option %(option)s \
-[%(current_value)s]: ')
+        input_fmt = _(u'Enter new value for option %(option)s '
+                      u'[%(current_value)s]: ')
         failures = 0
 
         w_std(_(u'Using configuration file: %s\n') % self._cfg_filename)
@@ -47,8 +47,8 @@
                             w_std(_(u'Warning: %s') % e)
                             failures += 1
                             if failures > 2:
-                                raise ConfigError(
-                                    _(u'Too many failures - try again later.'),
+                                raise ConfigError(_(u'Too many failures - try '
+                                                    u'again later.'),
                                                   VMM_TOO_MANY_FAILURES)
                     else:
                         break
--- a/VirtualMailManager/ext/Postconf.py	Wed May 05 21:50:31 2010 +0000
+++ b/VirtualMailManager/ext/Postconf.py	Sun May 09 06:20:52 2010 +0000
@@ -39,8 +39,9 @@
         expand_vars -- default True (bool)
         """
         if not re.match(RE_PC_PARAMS, parameter):
-            raise VMMError(_(u'The value “%s” doesn\'t look like a valid\
- postfix configuration parameter name.') % parameter, ERR.VMM_ERROR)
+            raise VMMError(_(u"The value '%s' doesn't look like a valid "
+                             u"postfix configuration parameter name.") %
+                           parameter, ERR.VMM_ERROR)
         self.__val = self.__read(parameter)
         if expand_vars:
             self.__expandVars()
--- a/VirtualMailManager/password.py	Wed May 05 21:50:31 2010 +0000
+++ b/VirtualMailManager/password.py	Sun May 09 06:20:52 2010 +0000
@@ -210,8 +210,8 @@
         else:
             md5.update('%s::' % user)
     md5.update(password)
-    if (scheme in ('PLAIN-MD5', 'DIGEST-MD5') and encoding in DEFAULT_HEX) \
-      or (scheme == 'LDAP-MD5' and encoding == 'HEX'):
+    if (scheme in ('PLAIN-MD5', 'DIGEST-MD5') and encoding in DEFAULT_HEX) or \
+       (scheme == 'LDAP-MD5' and encoding == 'HEX'):
         digest = md5.hexdigest()
     else:
         digest = md5.digest().encode('base64').rstrip()
@@ -367,16 +367,14 @@
         raise VMMError(_(u"Unsupported password scheme: '%s'") % scheme,
                        VMM_ERROR)
     if cfg_dget('misc.dovecot_version') < _scheme_info[scheme][1]:
-        raise VMMError(_(u"The password scheme '%(scheme)s' requires Dovecot \
->= v%(version)s") %
-                       {'scheme': scheme,
-                        'version': version_str(_scheme_info[scheme][1])},
+        raise VMMError(_(u"The password scheme '%(scheme)s' requires Dovecot "
+                         u">= v%(version)s") % {'scheme': scheme,
+                       'version': version_str(_scheme_info[scheme][1])},
                        VMM_ERROR)
     if len(scheme_encoding) > 1:
         if cfg_dget('misc.dovecot_version') < 0x10100a01:
-            raise VMMError(_(u'Encoding suffixes for password schemes require \
-Dovecot >= v1.1.alpha1'),
-                           VMM_ERROR)
+            raise VMMError(_(u'Encoding suffixes for password schemes require '
+                             u'Dovecot >= v1.1.alpha1'), VMM_ERROR)
         if scheme_encoding[1] not in ('B64', 'BASE64', 'HEX'):
             raise VMMError(_(u"Unsupported password encoding: '%s'") %
                            scheme_encoding[1], VMM_ERROR)