VirtualMailManager/handler.py
branchv0.6.x
changeset 335 7a471cace3ba
parent 333 1ed85e696748
child 337 150ddcc8b315
equal deleted inserted replaced
334:3f550826b1cc 335:7a471cace3ba
   631         if not acc:
   631         if not acc:
   632             raise VMMError(_(u"The account '%s' doesn't exist.") %
   632             raise VMMError(_(u"The account '%s' doesn't exist.") %
   633                            acc.address, NO_SUCH_ACCOUNT)
   633                            acc.address, NO_SUCH_ACCOUNT)
   634         acc.modify('transport', transport)
   634         acc.modify('transport', transport)
   635 
   635 
   636     def user_disable(self, emailaddress, service=None):
   636     def user_disable(self, emailaddress, services=None):
   637         """Wrapper for Account.disable(service)"""
   637         """Wrapper for Account.disable(*services)"""
   638         if service not in (None, 'all', 'imap', 'pop3', 'smtp', 'sieve'):
   638         if services is None:
   639             raise VMMError(_(u"Could not accept service: '%s'") % service,
   639             services = []
   640                            INVALID_ARGUMENT)
   640         else:
       
   641             assert isinstance(services, list)
   641         acc = self._get_account(emailaddress)
   642         acc = self._get_account(emailaddress)
   642         if not acc:
   643         if not acc:
   643             raise VMMError(_(u"The account '%s' doesn't exist.") %
   644             raise VMMError(_(u"The account '%s' doesn't exist.") % acc.address,
   644                            acc.address, NO_SUCH_ACCOUNT)
   645                            NO_SUCH_ACCOUNT)
   645         acc.disable(service)
   646         acc.disable(*services)
   646 
   647 
   647     def user_enable(self, emailaddress, service=None):
   648     def user_enable(self, emailaddress, services=None):
   648         """Wrapper for Account.enable(service)"""
   649         """Wrapper for Account.enable(*services)"""
   649         if service not in (None, 'all', 'imap', 'pop3', 'smtp', 'sieve'):
   650         if services is None:
   650             raise VMMError(_(u"Could not accept service: '%s'") % service,
   651             services = []
   651                            INVALID_ARGUMENT)
   652         else:
       
   653             assert isinstance(services, list)
   652         acc = self._get_account(emailaddress)
   654         acc = self._get_account(emailaddress)
   653         if not acc:
   655         if not acc:
   654             raise VMMError(_(u"The account '%s' doesn't exist.") %
   656             raise VMMError(_(u"The account '%s' doesn't exist.") % acc.address,
   655                            acc.address, NO_SUCH_ACCOUNT)
   657                            NO_SUCH_ACCOUNT)
   656         acc.enable(service)
   658         acc.enable(*services)
   657 
   659 
   658     def relocated_add(self, emailaddress, targetaddress):
   660     def relocated_add(self, emailaddress, targetaddress):
   659         """Creates a new `Relocated` entry in the database. If there is
   661         """Creates a new `Relocated` entry in the database. If there is
   660         already a relocated user with the given *emailaddress*, only the
   662         already a relocated user with the given *emailaddress*, only the
   661         *targetaddress* for the relocated user will be updated."""
   663         *targetaddress* for the relocated user will be updated."""