„speedup commit“ ;-)
authorPascal Volk <neverseen@users.sourceforge.net>
Thu, 11 Sep 2008 20:38:30 +0000
changeset 82 6c85915f3815
parent 81 89b71a9abfcf
child 83 cc195af37de0
„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
VirtualMailManager/Account.py
VirtualMailManager/Alias.py
VirtualMailManager/Relocated.py
create_optional_types_and_functions.pgsql
--- 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)
--- 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)
--- 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)
--- 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;