VirtualMailManager/account.py
branchv0.6.x
changeset 341 6709d0faf2f5
parent 338 45834dcc280e
child 352 22d115376e4d
equal deleted inserted replaced
340:4515afec62e5 341:6709d0faf2f5
    50             raise TypeError("Argument 'address' is not an EmailAddress")
    50             raise TypeError("Argument 'address' is not an EmailAddress")
    51         self._addr = address
    51         self._addr = address
    52         self._dbh = dbh
    52         self._dbh = dbh
    53         self._domain = Domain(self._dbh, self._addr.domainname)
    53         self._domain = Domain(self._dbh, self._addr.domainname)
    54         if not self._domain.gid:
    54         if not self._domain.gid:
       
    55             # TP: Hm, what “quotation marks” should be used?
       
    56             # If you are unsure have a look at:
       
    57             # http://en.wikipedia.org/wiki/Quotation_mark,_non-English_usage
    55             raise AErr(_(u"The domain '%s' doesn't exist.") %
    58             raise AErr(_(u"The domain '%s' doesn't exist.") %
    56                        self._addr.domainname, NO_SUCH_DOMAIN)
    59                        self._addr.domainname, NO_SUCH_DOMAIN)
    57         self._uid = 0
    60         self._uid = 0
    58         self._mail = None
    61         self._mail = None
    59         self._transport = self._domain.transport
    62         self._transport = self._domain.transport
   120         self._chk_state()
   123         self._chk_state()
   121         if services:
   124         if services:
   122             services = set(services)
   125             services = set(services)
   123             for service in services:
   126             for service in services:
   124                 if service not in SERVICES:
   127                 if service not in SERVICES:
   125                     raise AErr(_(u"Unknown service: '%s'.") % service,
   128                     raise AErr(_(u"Unknown service: '%s'") % service,
   126                                UNKNOWN_SERVICE)
   129                                UNKNOWN_SERVICE)
   127         else:
   130         else:
   128             services = SERVICES
   131             services = SERVICES
   129         state = ('FALSE', 'TRUE')[activate]
   132         state = ('FALSE', 'TRUE')[activate]
   130         sql = 'UPDATE users SET %s WHERE uid = %u' % (
   133         sql = 'UPDATE users SET %s WHERE uid = %u' % (
   203 
   206 
   204         `password` : basestring
   207         `password` : basestring
   205           The password for the new Account.
   208           The password for the new Account.
   206         """
   209         """
   207         if not isinstance(password, basestring) or not password:
   210         if not isinstance(password, basestring) or not password:
   208             raise AErr(_(u"Couldn't accept password: '%s'") % password,
   211             raise AErr(_(u"Could not accept password: '%s'") % password,
   209                        ACCOUNT_MISSING_PASSWORD)
   212                        ACCOUNT_MISSING_PASSWORD)
   210         self._passwd = password
   213         self._passwd = password
   211 
   214 
   212     def set_transport(self, transport):
   215     def set_transport(self, transport):
   213         """Set the transport for the new Account.
   216         """Set the transport for the new Account.
   335             info['mail_location'] = self._mail.mail_location
   338             info['mail_location'] = self._mail.mail_location
   336             info['transport'] = self._transport.transport
   339             info['transport'] = self._transport.transport
   337             info['uid'] = self._uid
   340             info['uid'] = self._uid
   338             return info
   341             return info
   339         # nearly impossible‽
   342         # nearly impossible‽
   340         raise AErr(_(u"Couldn't fetch information for account: '%s'") %
   343         raise AErr(_(u"Could not fetch information for account: '%s'") %
   341                    self._addr, NO_SUCH_ACCOUNT)
   344                    self._addr, NO_SUCH_ACCOUNT)
   342 
   345 
   343     def get_aliases(self):
   346     def get_aliases(self):
   344         """Return a list with all alias e-mail addresses, whose destination
   347         """Return a list with all alias e-mail addresses, whose destination
   345         is the address of the Account."""
   348         is the address of the Account."""