VirtualMailManager/Handler.py
branchv0.6.x
changeset 244 698ba4208ddc
parent 241 2493453f2c10
child 251 0963ad2f5fe2
equal deleted inserted replaced
243:30aaf2bc079c 244:698ba4208ddc
   474                     dom.get_aliases(), dom.get_relocated())
   474                     dom.get_aliases(), dom.get_relocated())
   475 
   475 
   476     def aliasDomainAdd(self, aliasname, domainname):
   476     def aliasDomainAdd(self, aliasname, domainname):
   477         """Adds an alias domain to the domain.
   477         """Adds an alias domain to the domain.
   478 
   478 
   479         Keyword arguments:
   479         Arguments:
   480         aliasname -- the name of the alias domain (str)
   480 
   481         domainname -- name of the target domain (str)
   481         `aliasname` : basestring
       
   482           The name of the alias domain
       
   483         `domainname` : basestring
       
   484           The name of the target domain
   482         """
   485         """
   483         dom = self.__getDomain(domainname)
   486         dom = self.__getDomain(domainname)
   484         aliasDom = AliasDomain(self._dbh, aliasname, dom)
   487         aliasDom = AliasDomain(self._dbh, aliasname)
       
   488         aliasDom.set_destination(dom)
   485         aliasDom.save()
   489         aliasDom.save()
   486 
   490 
   487     def aliasDomainInfo(self, aliasname):
   491     def aliasDomainInfo(self, aliasname):
       
   492         """Returns a dict (keys: "alias" and "domain") with the names of
       
   493         the alias domain and its primary domain."""
   488         self.__dbConnect()
   494         self.__dbConnect()
   489         aliasDom = AliasDomain(self._dbh, aliasname, None)
   495         aliasDom = AliasDomain(self._dbh, aliasname)
   490         return aliasDom.info()
   496         return aliasDom.info()
   491 
   497 
   492     def aliasDomainSwitch(self, aliasname, domainname):
   498     def aliasDomainSwitch(self, aliasname, domainname):
   493         """Modifies the target domain of an existing alias domain.
   499         """Modifies the target domain of an existing alias domain.
   494 
   500 
   495         Keyword arguments:
   501         Arguments:
   496         aliasname -- the name of the alias domain (str)
   502 
   497         domainname -- name of the new target domain (str)
   503         `aliasname` : basestring
       
   504           The name of the alias domain
       
   505         `domainname` : basestring
       
   506           The name of the new target domain
   498         """
   507         """
   499         dom = self.__getDomain(domainname)
   508         dom = self.__getDomain(domainname)
   500         aliasDom = AliasDomain(self._dbh, aliasname, dom)
   509         aliasDom = AliasDomain(self._dbh, aliasname)
       
   510         aliasDom.set_destination(dom)
   501         aliasDom.switch()
   511         aliasDom.switch()
   502 
   512 
   503     def aliasDomainDelete(self, aliasname):
   513     def aliasDomainDelete(self, aliasname):
   504         """Deletes the specified alias domain.
   514         """Deletes the given alias domain.
   505 
   515 
   506         Keyword arguments:
   516         Argument:
   507         aliasname -- the name of the alias domain (str)
   517 
       
   518         `aliasname` : basestring
       
   519           The name of the alias domain
   508         """
   520         """
   509         self.__dbConnect()
   521         self.__dbConnect()
   510         aliasDom = AliasDomain(self._dbh, aliasname, None)
   522         aliasDom = AliasDomain(self._dbh, aliasname)
   511         aliasDom.delete()
   523         aliasDom.delete()
   512 
   524 
   513     def domainList(self, pattern=None):
   525     def domainList(self, pattern=None):
   514         from VirtualMailManager.Domain import search
   526         from VirtualMailManager.Domain import search
   515         like = False
   527         like = False