# HG changeset patch # User Pascal Volk # Date 1221165510 0 # Node ID 6c85915f38152e500e2a5d4b7aa8c617cbc5a15f # Parent 89b71a9abfcf1ea05e739715dcd013459b12880c „speedup commit“ ;-) * 'VirtualMailManager/Account.py' - Account.__init__() checks only the existence of an alias or relocated record if there is no account with the supplied address yet * 'VirtualMailManager/Alias.py' - Alias.__init__() checks only the existence of an account or relocated record if there is no alias with the supplied address yet * 'VirtualMailManager/Relocated.py' - Relocated.__init__() checks only the existence of an account or alias record if there is no relocated user with the supplied address yet * 'create_optional_types_and_functions.pgsql' - Modified the 2nd part of postfix_smtpd_sender_login_map() in order to save 0.3 ms diff -r 89b71a9abfcf -r 6c85915f3815 VirtualMailManager/Account.py --- a/VirtualMailManager/Account.py Wed Sep 10 00:00:37 2008 +0000 +++ b/VirtualMailManager/Account.py Thu Sep 11 20:38:30 2008 +0000 @@ -36,10 +36,12 @@ self._passwd = password self._setAddr() self._exists() - if VMM.VirtualMailManager.aliasExists(self._dbh, self._addr): + if self._uid < 1 and VMM.VirtualMailManager.aliasExists(self._dbh, + self._addr): raise AccE(_(u"There is already an alias with the address »%s«.") %\ self._addr, ERR.ALIAS_EXISTS) - if VMM.VirtualMailManager.relocatedExists(self._dbh, self._addr): + if self._uid < 1 and VMM.VirtualMailManager.relocatedExists(self._dbh, + self._addr): raise AccE( _(u"There is already a relocated user with the address »%s«.") %\ self._addr, ERR.RELOCATED_EXISTS) diff -r 89b71a9abfcf -r 6c85915f3815 VirtualMailManager/Alias.py --- a/VirtualMailManager/Alias.py Wed Sep 10 00:00:37 2008 +0000 +++ b/VirtualMailManager/Alias.py Thu Sep 11 20:38:30 2008 +0000 @@ -40,10 +40,12 @@ self._setAddr() if not self._dest is None: self._exists() - if VMM.VirtualMailManager.accountExists(self._dbh, self._addr): + if self._isNew and VMM.VirtualMailManager.accountExists(self._dbh, + self._addr): raise VMMAE(_(u"There is already an account with address »%s«.") %\ self._addr, ERR.ACCOUNT_EXISTS) - if VMM.VirtualMailManager.relocatedExists(self._dbh, self._addr): + if self._isNew and VMM.VirtualMailManager.relocatedExists(self._dbh, + self._addr): raise VMMAE( _(u"There is already a relocated user with the address »%s«.") %\ self._addr, ERR.RELOCATED_EXISTS) diff -r 89b71a9abfcf -r 6c85915f3815 VirtualMailManager/Relocated.py --- a/VirtualMailManager/Relocated.py Wed Sep 10 00:00:37 2008 +0000 +++ b/VirtualMailManager/Relocated.py Thu Sep 11 20:38:30 2008 +0000 @@ -39,10 +39,12 @@ self._isNew = False self._setAddr() self._exists() - if VMM.VirtualMailManager.accountExists(self._dbh, self._addr): + if self._isNew and VMM.VirtualMailManager.accountExists(self._dbh, + self._addr): raise VMMRE(_(u"There is already an account with address »%s«.") %\ self._addr, ERR.ACCOUNT_EXISTS) - if VMM.VirtualMailManager.aliasExists(self._dbh, self._addr): + if self._isNew and VMM.VirtualMailManager.aliasExists(self._dbh, + self._addr): raise VMMRE( _(u"There is already an alias with the address »%s«.") %\ self._addr, ERR.ALIAS_EXISTS) diff -r 89b71a9abfcf -r 6c85915f3815 create_optional_types_and_functions.pgsql --- a/create_optional_types_and_functions.pgsql Wed Sep 10 00:00:37 2008 +0000 +++ b/create_optional_types_and_functions.pgsql Thu Sep 11 20:38:30 2008 +0000 @@ -48,8 +48,8 @@ FOR rec IN SELECT DISTINCT sender, destination FROM alias - LEFT JOIN domain_name USING (gid) - WHERE alias.address = localpart + WHERE alias.gid = did + AND alias.address = localpart LOOP RETURN NEXT rec; END LOOP;