533 def aliasAdd(self, aliasaddress, targetaddress): |
533 def aliasAdd(self, aliasaddress, targetaddress): |
534 """Creates a new `Alias` entry for the given *aliasaddress* with |
534 """Creates a new `Alias` entry for the given *aliasaddress* with |
535 the given *targetaddress*.""" |
535 the given *targetaddress*.""" |
536 alias = self.__getAlias(aliasaddress) |
536 alias = self.__getAlias(aliasaddress) |
537 destination = EmailAddress(targetaddress) |
537 destination = EmailAddress(targetaddress) |
538 alias.addDestination(destination, |
538 alias.add_destination(destination, |
539 long(self._postconf.read('virtual_alias_expansion_limit'))) |
539 long(self._postconf.read('virtual_alias_expansion_limit'))) |
540 gid = self.__getDomain(destination.domainname).getID() |
540 gid = self.__getDomain(destination.domainname).getID() |
541 if gid > 0 and (not Handler.accountExists(self._dbh, destination) and |
541 if gid > 0 and (not Handler.accountExists(self._dbh, destination) and |
542 not Handler.aliasExists(self._dbh, destination)): |
542 not Handler.aliasExists(self._dbh, destination)): |
543 self.__warnings.append( |
543 self.__warnings.append( |
571 def aliasInfo(self, aliasaddress): |
571 def aliasInfo(self, aliasaddress): |
572 """Returns an iterator object for all destinations (`EmailAddress` |
572 """Returns an iterator object for all destinations (`EmailAddress` |
573 instances) for the `Alias` with the given *aliasaddress*.""" |
573 instances) for the `Alias` with the given *aliasaddress*.""" |
574 alias = self.__getAlias(aliasaddress) |
574 alias = self.__getAlias(aliasaddress) |
575 try: |
575 try: |
576 return alias.getDestinations() |
576 return alias.get_destinations() |
577 except VMMAliasException, e: |
577 except VMMAliasException, e: |
578 if e.code() == ERR.NO_SUCH_ALIAS: |
578 if e.code() == ERR.NO_SUCH_ALIAS: |
579 if Handler.accountExists(self._dbh, alias._addr): |
579 if Handler.accountExists(self._dbh, alias._addr): |
580 raise VMMException( |
580 raise VMMException( |
581 _(u'There is already an account with address “%s”.') % |
581 _(u'There is already an account with address “%s”.') % |
594 destination will be removed from the alias.""" |
594 destination will be removed from the alias.""" |
595 alias = self.__getAlias(aliasaddress) |
595 alias = self.__getAlias(aliasaddress) |
596 if targetaddress is None: |
596 if targetaddress is None: |
597 alias.delete() |
597 alias.delete() |
598 else: |
598 else: |
599 alias.delDestination(EmailAddress(targetaddress)) |
599 alias.del_destination(EmailAddress(targetaddress)) |
600 |
600 |
601 def userInfo(self, emailaddress, details=None): |
601 def userInfo(self, emailaddress, details=None): |
602 if details not in (None, 'du', 'aliases', 'full'): |
602 if details not in (None, 'du', 'aliases', 'full'): |
603 raise VMMException(_(u'Invalid argument: “%s”') % details, |
603 raise VMMException(_(u'Invalid argument: “%s”') % details, |
604 ERR.INVALID_AGUMENT) |
604 ERR.INVALID_AGUMENT) |
658 def relocatedAdd(self, emailaddress, targetaddress): |
658 def relocatedAdd(self, emailaddress, targetaddress): |
659 """Creates a new `Relocated` entry in the database. If there is |
659 """Creates a new `Relocated` entry in the database. If there is |
660 already a relocated user with the given *emailaddress*, only the |
660 already a relocated user with the given *emailaddress*, only the |
661 *targetaddress* for the relocated user will be updated.""" |
661 *targetaddress* for the relocated user will be updated.""" |
662 relocated = self.__getRelocated(emailaddress) |
662 relocated = self.__getRelocated(emailaddress) |
663 relocated.setDestination(EmailAddress(targetaddress)) |
663 relocated.set_destination(EmailAddress(targetaddress)) |
664 |
664 |
665 def relocatedInfo(self, emailaddress): |
665 def relocatedInfo(self, emailaddress): |
666 """Returns the target address of the relocated user with the given |
666 """Returns the target address of the relocated user with the given |
667 *emailaddress*.""" |
667 *emailaddress*.""" |
668 relocated = self.__getRelocated(emailaddress) |
668 relocated = self.__getRelocated(emailaddress) |
669 return relocated.getInfo() |
669 return relocated.get_info() |
670 |
670 |
671 def relocatedDelete(self, emailaddress): |
671 def relocatedDelete(self, emailaddress): |
672 """Deletes the relocated user with the given *emailaddress* from |
672 """Deletes the relocated user with the given *emailaddress* from |
673 the database.""" |
673 the database.""" |
674 relocated = self.__getRelocated(emailaddress) |
674 relocated = self.__getRelocated(emailaddress) |