VirtualMailManager/Alias.py
changeset 38 c44ea4526546
parent 34 6d74e20c5b3b
child 47 191d5a5adc4a
equal deleted inserted replaced
37:89f952b0f366 38:c44ea4526546
    39         self._setAddr()
    39         self._setAddr()
    40         if not self._dest is None:
    40         if not self._dest is None:
    41             self._exists()
    41             self._exists()
    42         if self._isAccount():
    42         if self._isAccount():
    43             raise VMMAliasException(
    43             raise VMMAliasException(
    44             (_(u'There is already an account with address »%s«') % self._addr,
    44             (_(u"There is already an account with address '%s'") % self._addr,
    45                 ERR.ACCOUNT_EXISTS))
    45                 ERR.ACCOUNT_EXISTS))
    46 
    46 
    47     def _exists(self):
    47     def _exists(self):
    48         dbc = self._dbh.cursor()
    48         dbc = self._dbh.cursor()
    49         dbc.execute("SELECT gid FROM alias WHERE gid=%s AND address=%s\
    49         dbc.execute("SELECT gid FROM alias WHERE gid=%s AND address=%s\
    69     def _setAddr(self):
    69     def _setAddr(self):
    70         self._localpart, d = self._addr.split('@')
    70         self._localpart, d = self._addr.split('@')
    71         dom = Domain(self._dbh, d)
    71         dom = Domain(self._dbh, d)
    72         self._gid = dom.getID()
    72         self._gid = dom.getID()
    73         if self._gid == 0:
    73         if self._gid == 0:
    74             raise VMMAliasException((_(u"Domain »%s« doesn't exist.") % d,
    74             raise VMMAliasException((_(u"Domain '%s' doesn't exist.") % d,
    75                 ERR.NO_SUCH_DOMAIN))
    75                 ERR.NO_SUCH_DOMAIN))
    76 
    76 
    77     def save(self):
    77     def save(self):
    78         if self._dest is None:
    78         if self._dest is None:
    79            raise VMMAliasException((
    79            raise VMMAliasException((