* 'VirtualMailManager/AliasDomain.py'
* 'VirtualMailManager/constants/ERROR.py'
- Adjusted error codes
- 'VirtualMailManager/Domain.py'
- Domain.__init__() checks now whether the given domain name is known
for an alias domain
- Implemented Domain._isAlias()
- Corrected query in Domain.getAliaseNames() -> returns the alias names
ascending sorted
--- a/VirtualMailManager/AliasDomain.py Fri Aug 22 20:00:50 2008 +0000
+++ b/VirtualMailManager/AliasDomain.py Fri Aug 22 22:39:03 2008 +0000
@@ -36,15 +36,15 @@
self.__gid, primary = alias
if primary:
raise VADE(_(u"The domain »%s« is a primary domain.") %
- self.__name, ERR.DOMAIN_ALIAS_ISDOMAIN)
+ self.__name, ERR.ALIASDOMAIN_ISDOMAIN)
def save(self):
if self.__gid > 0:
raise VADE(_(u'The alias domain »%s« already exists.') %self.__name,
- ERR.DOMAIN_ALIAS_EXISTS)
+ ERR.ALIASDOMAIN_EXISTS)
if self._domain is None:
raise VADE(_(u'No destination domain for alias domain denoted.'),
- ERR.DOMAIN_ALIAS_NO_DOMDEST)
+ ERR.ALIASDOMAIN_NO_DOMDEST)
if self._domain._id < 1:
raise VADE (_(u"The target domain »%s« doesn't exist yet.") %
self._domain._name, ERR.NO_SUCH_DOMAIN)
@@ -71,7 +71,7 @@
else:
raise VADE(
_(u"The alias domain »%s« doesn't exist yet.") % self.__name,
- ERR.NO_SUCH_DOMAIN_ALIAS)
+ ERR.NO_SUCH_ALIASDOMAIN)
def delete(self):
if self.__gid > 0:
@@ -83,5 +83,5 @@
else:
raise VADE(
_(u"The alias domain »%s« doesn't exist yet.") % self.__name,
- ERR.NO_SUCH_DOMAIN_ALIAS)
+ ERR.NO_SUCH_ALIASDOMAIN)
--- a/VirtualMailManager/Domain.py Fri Aug 22 20:00:50 2008 +0000
+++ b/VirtualMailManager/Domain.py Fri Aug 22 22:39:03 2008 +0000
@@ -41,7 +41,9 @@
self._transport = transport
self._id = 0
self._domaindir = None
- self._exists()
+ if not self._exists() and self._isAlias():
+ raise VMMDE(_(u"The domain »%s« is an alias domain.") %self._name,
+ ERR.DOMAIN_ALIAS_EXISTS)
def _exists(self):
"""Checks if the domain already exists.
@@ -52,7 +54,7 @@
dbc = self._dbh.cursor()
dbc.execute("SELECT gid, tid, domaindir FROM domain_data WHERE gid =\
(SELECT gid FROM domain_name WHERE domainname = %s AND is_primary)",
- self._name)
+ self._name)
result = dbc.fetchone()
dbc.close()
if result is not None:
@@ -62,6 +64,18 @@
else:
return False
+ def _isAlias(self):
+ """Checks if self._name is known for an alias domain."""
+ dbc = self._dbh.cursor()
+ dbc.execute('SELECT is_primary FROM domain_name WHERE domainname = %s',
+ self._name)
+ result = dbc.fetchone()
+ dbc.close()
+ if result is not None and not result[0]:
+ return True
+ else:
+ return False
+
def _setID(self):
"""Sets the ID of the domain."""
dbc = self._dbh.cursor()
@@ -243,7 +257,7 @@
"""Returns a list with all alias names from the domain."""
dbc = self._dbh.cursor()
dbc.execute("SELECT domainname FROM domain_name WHERE gid = %s\
- AND NOT is_primary", self._id)
+ AND NOT is_primary ORDER BY domainname", self._id)
anames = dbc.fetchall()
dbc.close()
aliasdomains = []
--- a/VirtualMailManager/constants/ERROR.py Fri Aug 22 20:00:50 2008 +0000
+++ b/VirtualMailManager/constants/ERROR.py Fri Aug 22 22:39:03 2008 +0000
@@ -7,20 +7,20 @@
ACCOUNT_AND_ALIAS_PRESENT = 20
ACCOUNT_EXISTS = 21
ACCOUNT_PRESENT = 22
-ALIAS_ADDR_DEST_IDENTICAL = 23
-ALIAS_EXISTS = 24
-ALIAS_MISSING_DEST = 25
-ALIAS_PRESENT = 26
-CONF_ERROR = 27
-CONF_NOFILE = 28
-CONF_NOPERM = 29
-CONF_WRONGPERM = 30
-DATABASE_ERROR = 31
-DOMAINDIR_GROUP_MISMATCH = 32
-DOMAIN_ALIAS_EXISTS = 33
-DOMAIN_ALIAS_INIT = 34
-DOMAIN_ALIAS_ISDOMAIN = 35
-DOMAIN_ALIAS_NO_DOMDEST = 36
+ALIASDOMAIN_EXISTS = 23
+ALIASDOMAIN_ISDOMAIN = 24
+ALIASDOMAIN_NO_DOMDEST = 25
+ALIAS_ADDR_DEST_IDENTICAL = 26
+ALIAS_EXISTS = 27
+ALIAS_MISSING_DEST = 28
+ALIAS_PRESENT = 29
+CONF_ERROR = 30
+CONF_NOFILE = 31
+CONF_NOPERM = 32
+CONF_WRONGPERM = 33
+DATABASE_ERROR = 34
+DOMAINDIR_GROUP_MISMATCH = 35
+DOMAIN_ALIAS_EXISTS = 36
DOMAIN_EXISTS = 37
DOMAIN_INVALID = 38
DOMAIN_NO_NAME = 39
@@ -37,10 +37,10 @@
NOT_EXECUTABLE = 50
NO_SUCH_ACCOUNT = 51
NO_SUCH_ALIAS = 52
-NO_SUCH_BINARY = 53
-NO_SUCH_DIRECTORY = 54
-NO_SUCH_DOMAIN = 55
-NO_SUCH_DOMAIN_ALIAS = 56
+NO_SUCH_ALIASDOMAIN = 53
+NO_SUCH_BINARY = 54
+NO_SUCH_DIRECTORY = 55
+NO_SUCH_DOMAIN = 56
TRANSPORT_INIT = 57
UNKNOWN_MAILLOCATION_ID = 58
UNKNOWN_SERVICE = 59
--- a/po/de.po Fri Aug 22 20:00:50 2008 +0000
+++ b/po/de.po Fri Aug 22 22:39:03 2008 +0000
@@ -6,8 +6,8 @@
msgstr ""
"Project-Id-Version: vmm 0.5\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2008-08-22 21:37+0200\n"
-"PO-Revision-Date: 2008-08-22 21:57+0200\n"
+"POT-Creation-Date: 2008-08-22 23:51+0200\n"
+"PO-Revision-Date: 2008-08-22 23:52+0200\n"
"Last-Translator: Pascal Volk <p.volk@veb-it.de>\n"
"Language-Team: German\n"
"MIME-Version: 1.0\n"
@@ -21,8 +21,8 @@
msgstr "Es existiert bereits ein Alias mit der Adresse »%s«."
#: VirtualMailManager/Account.py:71 VirtualMailManager/Alias.py:72
-#: VirtualMailManager/Domain.py:155 VirtualMailManager/Domain.py:179
-#: VirtualMailManager/Domain.py:209
+#: VirtualMailManager/Domain.py:169 VirtualMailManager/Domain.py:193
+#: VirtualMailManager/Domain.py:223
#, python-format
msgid "The domain »%s« doesn't exist yet."
msgstr "Die Domain »%s« existiert noch nicht."
@@ -136,19 +136,24 @@
msgid "Enter new value for option %(opt)s [%(val)s]: "
msgstr "Neuer Wert für Option %(opt)s [%(val)s]: "
-#: VirtualMailManager/Domain.py:116
+#: VirtualMailManager/Domain.py:45
+#, python-format
+msgid "The domain »%s« is an alias domain."
+msgstr "Die Domain »%s« ist eine Alias-Domain."
+
+#: VirtualMailManager/Domain.py:130
msgid "There are accounts and aliases."
msgstr "Es sind noch Accounts und Aliase vorhanden."
-#: VirtualMailManager/Domain.py:119
+#: VirtualMailManager/Domain.py:133
msgid "There are accounts."
msgstr "Es sind noch Accounts vorhanden."
-#: VirtualMailManager/Domain.py:122
+#: VirtualMailManager/Domain.py:136
msgid "There are aliases."
msgstr "Es sind noch Aliase vorhanden."
-#: VirtualMailManager/Domain.py:137
+#: VirtualMailManager/Domain.py:151
#, python-format
msgid "The domain »%s« already exists."
msgstr "Die Domain »%s« existiert bereits."
--- a/po/vmm.pot Fri Aug 22 20:00:50 2008 +0000
+++ b/po/vmm.pot Fri Aug 22 22:39:03 2008 +0000
@@ -8,7 +8,7 @@
msgstr ""
"Project-Id-Version: vmm 0.5\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2008-08-22 21:37+0200\n"
+"POT-Creation-Date: 2008-08-23 00:12+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -22,8 +22,8 @@
msgstr ""
#: VirtualMailManager/Account.py:71 VirtualMailManager/Alias.py:72
-#: VirtualMailManager/Domain.py:155 VirtualMailManager/Domain.py:179
-#: VirtualMailManager/Domain.py:209
+#: VirtualMailManager/Domain.py:169 VirtualMailManager/Domain.py:193
+#: VirtualMailManager/Domain.py:223
#, python-format
msgid "The domain »%s« doesn't exist yet."
msgstr ""
@@ -137,19 +137,24 @@
msgid "Enter new value for option %(opt)s [%(val)s]: "
msgstr ""
-#: VirtualMailManager/Domain.py:116
+#: VirtualMailManager/Domain.py:45
+#, python-format
+msgid "The domain »%s« is an alias domain."
+msgstr ""
+
+#: VirtualMailManager/Domain.py:130
msgid "There are accounts and aliases."
msgstr ""
-#: VirtualMailManager/Domain.py:119
+#: VirtualMailManager/Domain.py:133
msgid "There are accounts."
msgstr ""
-#: VirtualMailManager/Domain.py:122
+#: VirtualMailManager/Domain.py:136
msgid "There are aliases."
msgstr ""
-#: VirtualMailManager/Domain.py:137
+#: VirtualMailManager/Domain.py:151
#, python-format
msgid "The domain »%s« already exists."
msgstr ""