diff -r b6c4e77046b9 -r 8e9b0046bc8f VirtualMailManager/common.py --- a/VirtualMailManager/common.py Mon Sep 03 22:40:01 2012 +0000 +++ b/VirtualMailManager/common.py Wed Sep 05 21:30:42 2012 +0000 @@ -187,6 +187,7 @@ _version_cache[version] = version_string return version_string + def format_domain_default(domaindata): """Format info output when the value displayed is the domain default.""" # TP: [domain default] indicates that a user's setting is the same as @@ -218,19 +219,19 @@ type, and boolean indicating whether the address stems from an alias domain. """ - if typelimit == None: + if typelimit is None: typelimit = TYPE_ACCOUNT | TYPE_ALIAS | TYPE_RELOCATED queries = [] if typelimit & TYPE_ACCOUNT: queries.append('SELECT gid, local_part, %d AS type FROM users' % TYPE_ACCOUNT) if typelimit & TYPE_ALIAS: - queries.append('SELECT DISTINCT gid, address as local_part, %d AS type ' - 'FROM alias' % TYPE_ALIAS) + queries.append('SELECT DISTINCT gid, address as local_part, ' + '%d AS type FROM alias' % TYPE_ALIAS) if typelimit & TYPE_RELOCATED: queries.append('SELECT gid, address as local_part, %d AS type ' 'FROM relocated' % TYPE_RELOCATED) - sql = "SELECT gid, local_part || '@' || domainname AS address, " + sql = "SELECT gid, local_part || '@' || domainname AS address, " sql += 'type, NOT is_primary AS from_aliasdomain FROM (' sql += ' UNION '.join(queries) sql += ') a JOIN domain_name USING (gid)' @@ -241,7 +242,8 @@ if like: match = 'LIKE' else: - if not pattern: continue + if not pattern: + continue match = '=' sql += ' %s %s %s %%s' % (nextkw, field, match) sqlargs.append(pattern)