author | Pascal Volk <neverseen@users.sourceforge.net> |
Sat, 03 Sep 2011 22:07:55 +0000 | |
branch | v0.6.x |
changeset 427 | 8e41e77b84e6 |
parent 417 | 8209da83e256 |
child 480 | 099de308fd98 |
permissions | -rw-r--r-- |
76
14c0a092d7d2
* 'VirtualMailManager/EmailAddress.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
1 |
# -*- coding: UTF-8 -*- |
366
d6573da35b5f
Updated copyright notices to include the year 2011.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
352
diff
changeset
|
2 |
# Copyright (c) 2008 - 2011, Pascal Volk |
76
14c0a092d7d2
* 'VirtualMailManager/EmailAddress.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
3 |
# See COPYING for distribution information. |
197
d2712e8c724e
VMM/{Relocated,Handler}: reworked Relocated class, adjusted Handler.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
185
diff
changeset
|
4 |
""" |
320
011066435e6f
VMM/*: Made all modules names lowercase, adjusted imports.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
316
diff
changeset
|
5 |
VirtualMailManager.relocated |
011066435e6f
VMM/*: Made all modules names lowercase, adjusted imports.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
316
diff
changeset
|
6 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
76
14c0a092d7d2
* 'VirtualMailManager/EmailAddress.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
7 |
|
197
d2712e8c724e
VMM/{Relocated,Handler}: reworked Relocated class, adjusted Handler.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
185
diff
changeset
|
8 |
Virtual Mail Manager's Relocated class to handle relocated users. |
d2712e8c724e
VMM/{Relocated,Handler}: reworked Relocated class, adjusted Handler.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
185
diff
changeset
|
9 |
""" |
d2712e8c724e
VMM/{Relocated,Handler}: reworked Relocated class, adjusted Handler.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
185
diff
changeset
|
10 |
|
320
011066435e6f
VMM/*: Made all modules names lowercase, adjusted imports.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
316
diff
changeset
|
11 |
from VirtualMailManager.domain import get_gid |
011066435e6f
VMM/*: Made all modules names lowercase, adjusted imports.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
316
diff
changeset
|
12 |
from VirtualMailManager.emailaddress import EmailAddress |
216
0c8c053b451c
Moved VirtualMailManager/Exceptions to VirtualMailManager/errors.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
215
diff
changeset
|
13 |
from VirtualMailManager.errors import RelocatedError as RErr |
316
31d8931dc535
VMM/constants: Replaced the constants subpackage by a module.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
290
diff
changeset
|
14 |
from VirtualMailManager.constants import NO_SUCH_DOMAIN, \ |
197
d2712e8c724e
VMM/{Relocated,Handler}: reworked Relocated class, adjusted Handler.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
185
diff
changeset
|
15 |
NO_SUCH_RELOCATED, RELOCATED_ADDR_DEST_IDENTICAL, RELOCATED_EXISTS |
d2712e8c724e
VMM/{Relocated,Handler}: reworked Relocated class, adjusted Handler.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
185
diff
changeset
|
16 |
|
d2712e8c724e
VMM/{Relocated,Handler}: reworked Relocated class, adjusted Handler.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
185
diff
changeset
|
17 |
|
d2712e8c724e
VMM/{Relocated,Handler}: reworked Relocated class, adjusted Handler.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
185
diff
changeset
|
18 |
_ = lambda msg: msg |
d2712e8c724e
VMM/{Relocated,Handler}: reworked Relocated class, adjusted Handler.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
185
diff
changeset
|
19 |
|
76
14c0a092d7d2
* 'VirtualMailManager/EmailAddress.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
20 |
|
122
30abf0abf8f8
Converted to new-style class, added __slots__.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
102
diff
changeset
|
21 |
class Relocated(object): |
197
d2712e8c724e
VMM/{Relocated,Handler}: reworked Relocated class, adjusted Handler.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
185
diff
changeset
|
22 |
"""Class to handle e-mail addresses of relocated users.""" |
d2712e8c724e
VMM/{Relocated,Handler}: reworked Relocated class, adjusted Handler.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
185
diff
changeset
|
23 |
__slots__ = ('_addr', '_dest', '_gid', '_dbh') |
d2712e8c724e
VMM/{Relocated,Handler}: reworked Relocated class, adjusted Handler.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
185
diff
changeset
|
24 |
|
d2712e8c724e
VMM/{Relocated,Handler}: reworked Relocated class, adjusted Handler.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
185
diff
changeset
|
25 |
def __init__(self, dbh, address): |
215
33f727efa7c4
PEP-8-ified the work of the last days.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
213
diff
changeset
|
26 |
"""Creates a new *Relocated* instance. The ``address`` is the |
197
d2712e8c724e
VMM/{Relocated,Handler}: reworked Relocated class, adjusted Handler.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
185
diff
changeset
|
27 |
old e-mail address of the user. |
d2712e8c724e
VMM/{Relocated,Handler}: reworked Relocated class, adjusted Handler.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
185
diff
changeset
|
28 |
|
d2712e8c724e
VMM/{Relocated,Handler}: reworked Relocated class, adjusted Handler.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
185
diff
changeset
|
29 |
Use `setDestination()` to set/update the new address, where the |
215
33f727efa7c4
PEP-8-ified the work of the last days.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
213
diff
changeset
|
30 |
user has moved to. |
33f727efa7c4
PEP-8-ified the work of the last days.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
213
diff
changeset
|
31 |
|
33f727efa7c4
PEP-8-ified the work of the last days.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
213
diff
changeset
|
32 |
""" |
213
1a9fee6b93bc
VMM:/{Alias,EmailAddress,Relocated}: use assertions for argument checks.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
202
diff
changeset
|
33 |
assert isinstance(address, EmailAddress) |
202
43e7c8b440da
VMM/Relocated: small code cleanups and cosmetic.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
198
diff
changeset
|
34 |
self._addr = address |
76
14c0a092d7d2
* 'VirtualMailManager/EmailAddress.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
35 |
self._dbh = dbh |
198
02d467e4fbab
VMM/Domain: added function get_gid() to the Domain module.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
197
diff
changeset
|
36 |
self._gid = get_gid(self._dbh, self._addr.domainname) |
222
d0c16e70a9fb
VMM/Domain: get_gid() return 0 instead of raising an Exception,
Pascal Volk <neverseen@users.sourceforge.net>
parents:
216
diff
changeset
|
37 |
if not self._gid: |
417
8209da83e256
VMM: Updated some messages. (doesn't, isn't) -> (does not, is not)
Pascal Volk <neverseen@users.sourceforge.net>
parents:
379
diff
changeset
|
38 |
raise RErr(_(u"The domain '%s' does not exist.") % |
222
d0c16e70a9fb
VMM/Domain: get_gid() return 0 instead of raising an Exception,
Pascal Volk <neverseen@users.sourceforge.net>
parents:
216
diff
changeset
|
39 |
self._addr.domainname, NO_SUCH_DOMAIN) |
197
d2712e8c724e
VMM/{Relocated,Handler}: reworked Relocated class, adjusted Handler.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
185
diff
changeset
|
40 |
self._dest = None |
76
14c0a092d7d2
* 'VirtualMailManager/EmailAddress.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
41 |
|
322
94bd10e237e5
VMM/…: More PEP-8 fixes; eliminated __names.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
320
diff
changeset
|
42 |
self._load() |
76
14c0a092d7d2
* 'VirtualMailManager/EmailAddress.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
43 |
|
249
bb7d9906c529
VMM/Relocated: implemented Relocated.__nonzero__() for truth value testing.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
222
diff
changeset
|
44 |
def __nonzero__(self): |
bb7d9906c529
VMM/Relocated: implemented Relocated.__nonzero__() for truth value testing.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
222
diff
changeset
|
45 |
"""Returns `True` if the Relocated is known, `False` if it's new.""" |
bb7d9906c529
VMM/Relocated: implemented Relocated.__nonzero__() for truth value testing.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
222
diff
changeset
|
46 |
return self._dest is not None |
bb7d9906c529
VMM/Relocated: implemented Relocated.__nonzero__() for truth value testing.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
222
diff
changeset
|
47 |
|
322
94bd10e237e5
VMM/…: More PEP-8 fixes; eliminated __names.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
320
diff
changeset
|
48 |
def _load(self): |
197
d2712e8c724e
VMM/{Relocated,Handler}: reworked Relocated class, adjusted Handler.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
185
diff
changeset
|
49 |
"""Loads the destination address from the database into the |
215
33f727efa7c4
PEP-8-ified the work of the last days.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
213
diff
changeset
|
50 |
`_dest` attribute. |
33f727efa7c4
PEP-8-ified the work of the last days.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
213
diff
changeset
|
51 |
|
33f727efa7c4
PEP-8-ified the work of the last days.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
213
diff
changeset
|
52 |
""" |
197
d2712e8c724e
VMM/{Relocated,Handler}: reworked Relocated class, adjusted Handler.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
185
diff
changeset
|
53 |
dbc = self._dbh.cursor() |
290
e2785e04f92e
VMM/…: re-indented long queries and error messages.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
250
diff
changeset
|
54 |
dbc.execute('SELECT destination FROM relocated WHERE gid = %s AND ' |
352
22d115376e4d
VMM/…: Provide parameters as tuple to cursor.execute().
Pascal Volk <neverseen@users.sourceforge.net>
parents:
341
diff
changeset
|
55 |
'address = %s', (self._gid, self._addr.localpart)) |
197
d2712e8c724e
VMM/{Relocated,Handler}: reworked Relocated class, adjusted Handler.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
185
diff
changeset
|
56 |
destination = dbc.fetchone() |
d2712e8c724e
VMM/{Relocated,Handler}: reworked Relocated class, adjusted Handler.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
185
diff
changeset
|
57 |
dbc.close() |
d2712e8c724e
VMM/{Relocated,Handler}: reworked Relocated class, adjusted Handler.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
185
diff
changeset
|
58 |
if destination: |
d2712e8c724e
VMM/{Relocated,Handler}: reworked Relocated class, adjusted Handler.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
185
diff
changeset
|
59 |
self._dest = EmailAddress(destination[0]) |
76
14c0a092d7d2
* 'VirtualMailManager/EmailAddress.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
60 |
|
250
73cd082cd724
VMM/{Account,Alias,Relocated}: added a address property to the classes
Pascal Volk <neverseen@users.sourceforge.net>
parents:
249
diff
changeset
|
61 |
@property |
73cd082cd724
VMM/{Account,Alias,Relocated}: added a address property to the classes
Pascal Volk <neverseen@users.sourceforge.net>
parents:
249
diff
changeset
|
62 |
def address(self): |
73cd082cd724
VMM/{Account,Alias,Relocated}: added a address property to the classes
Pascal Volk <neverseen@users.sourceforge.net>
parents:
249
diff
changeset
|
63 |
"""The Relocated's EmailAddress instance.""" |
73cd082cd724
VMM/{Account,Alias,Relocated}: added a address property to the classes
Pascal Volk <neverseen@users.sourceforge.net>
parents:
249
diff
changeset
|
64 |
return self._addr |
73cd082cd724
VMM/{Account,Alias,Relocated}: added a address property to the classes
Pascal Volk <neverseen@users.sourceforge.net>
parents:
249
diff
changeset
|
65 |
|
215
33f727efa7c4
PEP-8-ified the work of the last days.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
213
diff
changeset
|
66 |
def set_destination(self, destination): |
197
d2712e8c724e
VMM/{Relocated,Handler}: reworked Relocated class, adjusted Handler.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
185
diff
changeset
|
67 |
"""Sets/updates the new address of the relocated user.""" |
d2712e8c724e
VMM/{Relocated,Handler}: reworked Relocated class, adjusted Handler.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
185
diff
changeset
|
68 |
update = False |
213
1a9fee6b93bc
VMM:/{Alias,EmailAddress,Relocated}: use assertions for argument checks.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
202
diff
changeset
|
69 |
assert isinstance(destination, EmailAddress) |
202
43e7c8b440da
VMM/Relocated: small code cleanups and cosmetic.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
198
diff
changeset
|
70 |
if self._addr == destination: |
216
0c8c053b451c
Moved VirtualMailManager/Exceptions to VirtualMailManager/errors.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
215
diff
changeset
|
71 |
raise RErr(_(u'Address and destination are identical.'), |
0c8c053b451c
Moved VirtualMailManager/Exceptions to VirtualMailManager/errors.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
215
diff
changeset
|
72 |
RELOCATED_ADDR_DEST_IDENTICAL) |
202
43e7c8b440da
VMM/Relocated: small code cleanups and cosmetic.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
198
diff
changeset
|
73 |
if self._dest: |
43e7c8b440da
VMM/Relocated: small code cleanups and cosmetic.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
198
diff
changeset
|
74 |
if self._dest == destination: |
249
bb7d9906c529
VMM/Relocated: implemented Relocated.__nonzero__() for truth value testing.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
222
diff
changeset
|
75 |
raise RErr(_(u"The relocated user '%s' already exists.") % |
216
0c8c053b451c
Moved VirtualMailManager/Exceptions to VirtualMailManager/errors.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
215
diff
changeset
|
76 |
self._addr, RELOCATED_EXISTS) |
197
d2712e8c724e
VMM/{Relocated,Handler}: reworked Relocated class, adjusted Handler.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
185
diff
changeset
|
77 |
else: |
d2712e8c724e
VMM/{Relocated,Handler}: reworked Relocated class, adjusted Handler.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
185
diff
changeset
|
78 |
self._dest = destination |
202
43e7c8b440da
VMM/Relocated: small code cleanups and cosmetic.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
198
diff
changeset
|
79 |
update = True |
76
14c0a092d7d2
* 'VirtualMailManager/EmailAddress.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
80 |
else: |
202
43e7c8b440da
VMM/Relocated: small code cleanups and cosmetic.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
198
diff
changeset
|
81 |
self._dest = destination |
197
d2712e8c724e
VMM/{Relocated,Handler}: reworked Relocated class, adjusted Handler.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
185
diff
changeset
|
82 |
|
d2712e8c724e
VMM/{Relocated,Handler}: reworked Relocated class, adjusted Handler.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
185
diff
changeset
|
83 |
dbc = self._dbh.cursor() |
d2712e8c724e
VMM/{Relocated,Handler}: reworked Relocated class, adjusted Handler.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
185
diff
changeset
|
84 |
if not update: |
379
7518d927d443
VMM/*: Use target column names in all INSERT statements.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
366
diff
changeset
|
85 |
dbc.execute('INSERT INTO relocated (gid, address, destination) ' |
7518d927d443
VMM/*: Use target column names in all INSERT statements.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
366
diff
changeset
|
86 |
'VALUES (%s, %s, %s)', |
352
22d115376e4d
VMM/…: Provide parameters as tuple to cursor.execute().
Pascal Volk <neverseen@users.sourceforge.net>
parents:
341
diff
changeset
|
87 |
(self._gid, self._addr.localpart, str(self._dest))) |
197
d2712e8c724e
VMM/{Relocated,Handler}: reworked Relocated class, adjusted Handler.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
185
diff
changeset
|
88 |
else: |
290
e2785e04f92e
VMM/…: re-indented long queries and error messages.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
250
diff
changeset
|
89 |
dbc.execute('UPDATE relocated SET destination = %s WHERE gid = %s ' |
352
22d115376e4d
VMM/…: Provide parameters as tuple to cursor.execute().
Pascal Volk <neverseen@users.sourceforge.net>
parents:
341
diff
changeset
|
90 |
'AND address = %s', |
22d115376e4d
VMM/…: Provide parameters as tuple to cursor.execute().
Pascal Volk <neverseen@users.sourceforge.net>
parents:
341
diff
changeset
|
91 |
(str(self._dest), self._gid, self._addr.localpart)) |
197
d2712e8c724e
VMM/{Relocated,Handler}: reworked Relocated class, adjusted Handler.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
185
diff
changeset
|
92 |
self._dbh.commit() |
d2712e8c724e
VMM/{Relocated,Handler}: reworked Relocated class, adjusted Handler.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
185
diff
changeset
|
93 |
dbc.close() |
76
14c0a092d7d2
* 'VirtualMailManager/EmailAddress.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
94 |
|
215
33f727efa7c4
PEP-8-ified the work of the last days.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
213
diff
changeset
|
95 |
def get_info(self): |
197
d2712e8c724e
VMM/{Relocated,Handler}: reworked Relocated class, adjusted Handler.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
185
diff
changeset
|
96 |
"""Returns the address to which mails should be sent.""" |
202
43e7c8b440da
VMM/Relocated: small code cleanups and cosmetic.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
198
diff
changeset
|
97 |
if not self._dest: |
417
8209da83e256
VMM: Updated some messages. (doesn't, isn't) -> (does not, is not)
Pascal Volk <neverseen@users.sourceforge.net>
parents:
379
diff
changeset
|
98 |
raise RErr(_(u"The relocated user '%s' does not exist.") % |
216
0c8c053b451c
Moved VirtualMailManager/Exceptions to VirtualMailManager/errors.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
215
diff
changeset
|
99 |
self._addr, NO_SUCH_RELOCATED) |
202
43e7c8b440da
VMM/Relocated: small code cleanups and cosmetic.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
198
diff
changeset
|
100 |
return self._dest |
76
14c0a092d7d2
* 'VirtualMailManager/EmailAddress.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
101 |
|
14c0a092d7d2
* 'VirtualMailManager/EmailAddress.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
102 |
def delete(self): |
197
d2712e8c724e
VMM/{Relocated,Handler}: reworked Relocated class, adjusted Handler.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
185
diff
changeset
|
103 |
"""Deletes the relocated entry from the database.""" |
d2712e8c724e
VMM/{Relocated,Handler}: reworked Relocated class, adjusted Handler.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
185
diff
changeset
|
104 |
if not self._dest: |
417
8209da83e256
VMM: Updated some messages. (doesn't, isn't) -> (does not, is not)
Pascal Volk <neverseen@users.sourceforge.net>
parents:
379
diff
changeset
|
105 |
raise RErr(_(u"The relocated user '%s' does not exist.") % |
249
bb7d9906c529
VMM/Relocated: implemented Relocated.__nonzero__() for truth value testing.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
222
diff
changeset
|
106 |
self._addr, NO_SUCH_RELOCATED) |
76
14c0a092d7d2
* 'VirtualMailManager/EmailAddress.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
107 |
dbc = self._dbh.cursor() |
290
e2785e04f92e
VMM/…: re-indented long queries and error messages.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
250
diff
changeset
|
108 |
dbc.execute('DELETE FROM relocated WHERE gid = %s AND address = %s', |
352
22d115376e4d
VMM/…: Provide parameters as tuple to cursor.execute().
Pascal Volk <neverseen@users.sourceforge.net>
parents:
341
diff
changeset
|
109 |
(self._gid, self._addr.localpart)) |
197
d2712e8c724e
VMM/{Relocated,Handler}: reworked Relocated class, adjusted Handler.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
185
diff
changeset
|
110 |
if dbc.rowcount > 0: |
76
14c0a092d7d2
* 'VirtualMailManager/EmailAddress.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
111 |
self._dbh.commit() |
197
d2712e8c724e
VMM/{Relocated,Handler}: reworked Relocated class, adjusted Handler.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
185
diff
changeset
|
112 |
dbc.close() |
d2712e8c724e
VMM/{Relocated,Handler}: reworked Relocated class, adjusted Handler.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
185
diff
changeset
|
113 |
self._dest = None |
76
14c0a092d7d2
* 'VirtualMailManager/EmailAddress.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
114 |
|
197
d2712e8c724e
VMM/{Relocated,Handler}: reworked Relocated class, adjusted Handler.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
185
diff
changeset
|
115 |
del _ |