author | Pascal Volk <neverseen@users.sourceforge.net> |
Fri, 21 Aug 2009 08:10:10 +0000 | |
changeset 124 | 68af38212ff5 |
parent 122 | 30abf0abf8f8 |
child 129 | 4ffb50de00d5 |
permissions | -rw-r--r-- |
0
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
1 |
# -*- coding: UTF-8 -*- |
102
485d3f7d6981
Removed svn keywords, more POSIX compliant shell scripts
Pascal Volk <neverseen@users.sourceforge.net>
parents:
89
diff
changeset
|
2 |
# Copyright (c) 2007 - 2009, VEB IT |
0
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
3 |
# See COPYING for distribution information. |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
4 |
|
3
a9b44e04bf01
* VirtualMailManager/Account.py:
Pascal Volk <neverseen@users.sourceforge.net>
parents:
0
diff
changeset
|
5 |
"""Virtual Mail Manager's Alias class to manage e-mail aliases.""" |
0
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
6 |
|
102
485d3f7d6981
Removed svn keywords, more POSIX compliant shell scripts
Pascal Volk <neverseen@users.sourceforge.net>
parents:
89
diff
changeset
|
7 |
from constants.VERSION import * |
0
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
8 |
|
52
c152d7714802
* 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
48
diff
changeset
|
9 |
from Exceptions import VMMAliasException as VMMAE |
0
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
10 |
from Domain import Domain |
76
14c0a092d7d2
* 'VirtualMailManager/EmailAddress.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
52
diff
changeset
|
11 |
from EmailAddress import EmailAddress |
0
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
12 |
import constants.ERROR as ERR |
52
c152d7714802
* 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
48
diff
changeset
|
13 |
import VirtualMailManager as VMM |
0
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
14 |
|
122
30abf0abf8f8
Converted to new-style class, added __slots__.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
102
diff
changeset
|
15 |
class Alias(object): |
76
14c0a092d7d2
* 'VirtualMailManager/EmailAddress.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
52
diff
changeset
|
16 |
"""Class to manage e-mail aliases.""" |
122
30abf0abf8f8
Converted to new-style class, added __slots__.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
102
diff
changeset
|
17 |
__slots__ = ('_addr', '_dest', '_gid', '_isNew', '_dbh') |
9
e3d3dbeb5b84
* 'create_tables.pgsql'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
8
diff
changeset
|
18 |
def __init__(self, dbh, address, destination=None): |
76
14c0a092d7d2
* 'VirtualMailManager/EmailAddress.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
52
diff
changeset
|
19 |
if isinstance(address, EmailAddress): |
14c0a092d7d2
* 'VirtualMailManager/EmailAddress.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
52
diff
changeset
|
20 |
self._addr = address |
14c0a092d7d2
* 'VirtualMailManager/EmailAddress.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
52
diff
changeset
|
21 |
else: |
14c0a092d7d2
* 'VirtualMailManager/EmailAddress.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
52
diff
changeset
|
22 |
raise TypeError("Argument 'address' is not an EmailAddress") |
14c0a092d7d2
* 'VirtualMailManager/EmailAddress.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
52
diff
changeset
|
23 |
if destination is None: |
14c0a092d7d2
* 'VirtualMailManager/EmailAddress.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
52
diff
changeset
|
24 |
self._dest = None |
14c0a092d7d2
* 'VirtualMailManager/EmailAddress.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
52
diff
changeset
|
25 |
elif isinstance(destination, EmailAddress): |
14c0a092d7d2
* 'VirtualMailManager/EmailAddress.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
52
diff
changeset
|
26 |
self._dest = destination |
14c0a092d7d2
* 'VirtualMailManager/EmailAddress.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
52
diff
changeset
|
27 |
else: |
14c0a092d7d2
* 'VirtualMailManager/EmailAddress.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
52
diff
changeset
|
28 |
raise TypeError("Argument 'destination' is not an EmailAddress") |
0
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
29 |
if address == destination: |
52
c152d7714802
* 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
48
diff
changeset
|
30 |
raise VMMAE(_(u"Address and destination are identical."), |
48
0d5f58f8b8f5
* 'VirtualMailManager/Exceptions.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
47
diff
changeset
|
31 |
ERR.ALIAS_ADDR_DEST_IDENTICAL) |
0
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
32 |
self._dbh = dbh |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
33 |
self._gid = 0 |
9
e3d3dbeb5b84
* 'create_tables.pgsql'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
8
diff
changeset
|
34 |
self._isNew = False |
e3d3dbeb5b84
* 'create_tables.pgsql'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
8
diff
changeset
|
35 |
self._setAddr() |
0
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
36 |
if not self._dest is None: |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
37 |
self._exists() |
82
6c85915f3815
„speedup commit“ ;-)
Pascal Volk <neverseen@users.sourceforge.net>
parents:
78
diff
changeset
|
38 |
if self._isNew and VMM.VirtualMailManager.accountExists(self._dbh, |
6c85915f3815
„speedup commit“ ;-)
Pascal Volk <neverseen@users.sourceforge.net>
parents:
78
diff
changeset
|
39 |
self._addr): |
76
14c0a092d7d2
* 'VirtualMailManager/EmailAddress.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
52
diff
changeset
|
40 |
raise VMMAE(_(u"There is already an account with address »%s«.") %\ |
52
c152d7714802
* 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
48
diff
changeset
|
41 |
self._addr, ERR.ACCOUNT_EXISTS) |
82
6c85915f3815
„speedup commit“ ;-)
Pascal Volk <neverseen@users.sourceforge.net>
parents:
78
diff
changeset
|
42 |
if self._isNew and VMM.VirtualMailManager.relocatedExists(self._dbh, |
6c85915f3815
„speedup commit“ ;-)
Pascal Volk <neverseen@users.sourceforge.net>
parents:
78
diff
changeset
|
43 |
self._addr): |
76
14c0a092d7d2
* 'VirtualMailManager/EmailAddress.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
52
diff
changeset
|
44 |
raise VMMAE( |
78
8f1e501b1bb1
* 'VirtualMailManager/Account.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
76
diff
changeset
|
45 |
_(u"There is already a relocated user with the address »%s«.") %\ |
76
14c0a092d7d2
* 'VirtualMailManager/EmailAddress.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
52
diff
changeset
|
46 |
self._addr, ERR.RELOCATED_EXISTS) |
0
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
47 |
|
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
48 |
def _exists(self): |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
49 |
dbc = self._dbh.cursor() |
9
e3d3dbeb5b84
* 'create_tables.pgsql'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
8
diff
changeset
|
50 |
dbc.execute("SELECT gid FROM alias WHERE gid=%s AND address=%s\ |
76
14c0a092d7d2
* 'VirtualMailManager/EmailAddress.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
52
diff
changeset
|
51 |
AND destination=%s", self._gid, self._addr._localpart, str(self._dest)) |
9
e3d3dbeb5b84
* 'create_tables.pgsql'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
8
diff
changeset
|
52 |
gid = dbc.fetchone() |
0
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
53 |
dbc.close() |
9
e3d3dbeb5b84
* 'create_tables.pgsql'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
8
diff
changeset
|
54 |
if gid is None: |
e3d3dbeb5b84
* 'create_tables.pgsql'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
8
diff
changeset
|
55 |
self._isNew = True |
0
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
56 |
|
9
e3d3dbeb5b84
* 'create_tables.pgsql'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
8
diff
changeset
|
57 |
def _setAddr(self): |
76
14c0a092d7d2
* 'VirtualMailManager/EmailAddress.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
52
diff
changeset
|
58 |
dom = Domain(self._dbh, self._addr._domainname) |
0
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
59 |
self._gid = dom.getID() |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
60 |
if self._gid == 0: |
76
14c0a092d7d2
* 'VirtualMailManager/EmailAddress.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
52
diff
changeset
|
61 |
raise VMMAE(_(u"The domain »%s« doesn't exist yet.") %\ |
14c0a092d7d2
* 'VirtualMailManager/EmailAddress.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
52
diff
changeset
|
62 |
self._addr._domainname, ERR.NO_SUCH_DOMAIN) |
0
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
63 |
|
88
b3debcfea7bc
* 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
82
diff
changeset
|
64 |
def _checkExpansion(self, limit): |
b3debcfea7bc
* 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
82
diff
changeset
|
65 |
dbc = self._dbh.cursor() |
b3debcfea7bc
* 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
82
diff
changeset
|
66 |
dbc.execute('SELECT count(gid) FROM alias where gid=%s AND address=%s', |
b3debcfea7bc
* 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
82
diff
changeset
|
67 |
self._gid, self._addr._localpart) |
b3debcfea7bc
* 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
82
diff
changeset
|
68 |
curEx = dbc.fetchone()[0] |
b3debcfea7bc
* 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
82
diff
changeset
|
69 |
dbc.close() |
b3debcfea7bc
* 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
82
diff
changeset
|
70 |
if curEx == limit: |
b3debcfea7bc
* 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
82
diff
changeset
|
71 |
errmsg = _(u"""Can't add new destination to alias »%(address)s«. |
b3debcfea7bc
* 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
82
diff
changeset
|
72 |
Currently this alias expands into %(count)i recipients. |
89
752d3b57ebb6
small fixes/updates
Pascal Volk <neverseen@users.sourceforge.net>
parents:
88
diff
changeset
|
73 |
One more destination will render this alias unusable. |
88
b3debcfea7bc
* 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
82
diff
changeset
|
74 |
Hint: Increase Postfix' virtual_alias_expansion_limit |
b3debcfea7bc
* 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
82
diff
changeset
|
75 |
""") % {'address': self._addr, 'count': curEx} |
b3debcfea7bc
* 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
82
diff
changeset
|
76 |
raise VMMAE(errmsg, ERR.ALIAS_EXCEEDS_EXPANSION_LIMIT) |
b3debcfea7bc
* 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
82
diff
changeset
|
77 |
|
b3debcfea7bc
* 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
82
diff
changeset
|
78 |
def save(self, expansion_limit): |
0
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
79 |
if self._dest is None: |
52
c152d7714802
* 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
48
diff
changeset
|
80 |
raise VMMAE(_(u"No destination address for alias denoted."), |
48
0d5f58f8b8f5
* 'VirtualMailManager/Exceptions.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
47
diff
changeset
|
81 |
ERR.ALIAS_MISSING_DEST) |
9
e3d3dbeb5b84
* 'create_tables.pgsql'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
8
diff
changeset
|
82 |
if self._isNew: |
88
b3debcfea7bc
* 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
82
diff
changeset
|
83 |
self._checkExpansion(expansion_limit) |
0
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
84 |
dbc = self._dbh.cursor() |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
85 |
dbc.execute("INSERT INTO alias (gid, address, destination) VALUES\ |
76
14c0a092d7d2
* 'VirtualMailManager/EmailAddress.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
52
diff
changeset
|
86 |
(%s, %s, %s)", self._gid, self._addr._localpart, str(self._dest)) |
0
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
87 |
self._dbh.commit() |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
88 |
dbc.close() |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
89 |
else: |
76
14c0a092d7d2
* 'VirtualMailManager/EmailAddress.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
52
diff
changeset
|
90 |
raise VMMAE( |
14c0a092d7d2
* 'VirtualMailManager/EmailAddress.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
52
diff
changeset
|
91 |
_(u"The alias »%(a)s« with destination »%(d)s« already exists.")\ |
14c0a092d7d2
* 'VirtualMailManager/EmailAddress.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
52
diff
changeset
|
92 |
% {'a': self._addr, 'd': self._dest}, ERR.ALIAS_EXISTS) |
0
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
93 |
|
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
94 |
def getInfo(self): |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
95 |
dbc = self._dbh.cursor() |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
96 |
dbc.execute('SELECT destination FROM alias WHERE gid=%s AND address=%s', |
76
14c0a092d7d2
* 'VirtualMailManager/EmailAddress.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
52
diff
changeset
|
97 |
self._gid, self._addr._localpart) |
0
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
98 |
destinations = dbc.fetchall() |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
99 |
dbc.close() |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
100 |
if len(destinations) > 0: |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
101 |
targets = [] |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
102 |
for destination in destinations: |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
103 |
targets.append(destination[0]) |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
104 |
return targets |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
105 |
else: |
52
c152d7714802
* 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
48
diff
changeset
|
106 |
raise VMMAE(_(u"The alias »%s« doesn't exists.") % self._addr, |
c152d7714802
* 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
48
diff
changeset
|
107 |
ERR.NO_SUCH_ALIAS) |
0
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
108 |
|
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
109 |
def delete(self): |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
110 |
dbc = self._dbh.cursor() |
12
44161dbb1518
* 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
9
diff
changeset
|
111 |
if self._dest is None: |
44161dbb1518
* 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
9
diff
changeset
|
112 |
dbc.execute("DELETE FROM alias WHERE gid=%s AND address=%s", |
76
14c0a092d7d2
* 'VirtualMailManager/EmailAddress.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
52
diff
changeset
|
113 |
self._gid, self._addr._localpart) |
12
44161dbb1518
* 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
9
diff
changeset
|
114 |
else: |
44161dbb1518
* 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
9
diff
changeset
|
115 |
dbc.execute("DELETE FROM alias WHERE gid=%s AND address=%s AND \ |
76
14c0a092d7d2
* 'VirtualMailManager/EmailAddress.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
52
diff
changeset
|
116 |
destination=%s", self._gid, self._addr._localpart, str(self._dest)) |
0
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
117 |
rowcount = dbc.rowcount |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
118 |
dbc.close() |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
119 |
if rowcount > 0: |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
120 |
self._dbh.commit() |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
121 |
else: |
76
14c0a092d7d2
* 'VirtualMailManager/EmailAddress.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
52
diff
changeset
|
122 |
if self._dest is None: |
14c0a092d7d2
* 'VirtualMailManager/EmailAddress.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
52
diff
changeset
|
123 |
msg = u"The alias »%s« doesn't exists." % self._addr |
14c0a092d7d2
* 'VirtualMailManager/EmailAddress.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
52
diff
changeset
|
124 |
else: |
14c0a092d7d2
* 'VirtualMailManager/EmailAddress.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
52
diff
changeset
|
125 |
msg = u"The alias »%(a)s« with destination »%(d)s« doesn't\ |
14c0a092d7d2
* 'VirtualMailManager/EmailAddress.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
52
diff
changeset
|
126 |
exists." % {'a': self._addr, 'd': self._dest} |
14c0a092d7d2
* 'VirtualMailManager/EmailAddress.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
52
diff
changeset
|
127 |
raise VMMAE(_(msg), ERR.NO_SUCH_ALIAS) |
0
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
128 |