VirtualMailManager/VirtualMailManager.py
changeset 53 5b50eb306d37
parent 52 c152d7714802
child 54 1fc1f82c662f
equal deleted inserted replaced
52:c152d7714802 53:5b50eb306d37
    27 import constants.ERROR as ERR
    27 import constants.ERROR as ERR
    28 from Config import Config as Cfg
    28 from Config import Config as Cfg
    29 from Account import Account
    29 from Account import Account
    30 from Alias import Alias
    30 from Alias import Alias
    31 from Domain import Domain
    31 from Domain import Domain
       
    32 from DomainAlias import DomainAlias
    32 
    33 
    33 SALTCHARS = './0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
    34 SALTCHARS = './0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
    34 RE_ASCII_CHARS = """^[\x20-\x7E]*$"""
    35 RE_ASCII_CHARS = """^[\x20-\x7E]*$"""
    35 RE_DOMAIN = """^(?:[a-z0-9-]{1,63}\.){1,}[a-z]{2,6}$"""
    36 RE_DOMAIN = """^(?:[a-z0-9-]{1,63}\.){1,}[a-z]{2,6}$"""
    36 RE_DOMAIN_SRCH = """^[a-z0-9-\.]+$"""
    37 RE_DOMAIN_SRCH = """^[a-z0-9-\.]+$"""
   495             raise VMMDomainException(_(u'Invalid argument: »%s«') % detailed,
   496             raise VMMDomainException(_(u'Invalid argument: »%s«') % detailed,
   496                 ERR.INVALID_OPTION)
   497                 ERR.INVALID_OPTION)
   497 
   498 
   498     def domain_alias_add(self, aliasname, domainname):
   499     def domain_alias_add(self, aliasname, domainname):
   499         """Adds an alias name to the domain.
   500         """Adds an alias name to the domain.
   500         
   501 
   501         Keyword arguments:
   502         Keyword arguments:
   502         aliasname -- the alias name of the domain (str)
   503         aliasname -- the alias name of the domain (str)
   503         domainname -- name of the target domain (str)
   504         domainname -- name of the target domain (str)
   504         """
   505         """
   505         dom = self.__getDomain(domainname)
   506         dom = self.__getDomain(domainname)
   506         dom.saveAlias(aliasname)
   507         domAlias = DomainAlias(self.__dbh, aliasname, dom)
       
   508         domAlias.save()
       
   509 
       
   510     def domain_alias_info(self, aliasname):
       
   511         self.__dbConnect()
       
   512         domAlias = DomainAlias(self.__dbh, aliasname, None)
       
   513         return domAlias.info()
   507 
   514 
   508     def domain_alias_delete(self, aliasname):
   515     def domain_alias_delete(self, aliasname):
   509         """Deletes the specified alias name.
   516         """Deletes the specified alias name.
   510         
   517 
   511         Keyword arguments:
   518         Keyword arguments:
   512         aliasname -- the alias name of the domain (str)
   519         aliasname -- the alias name of the domain (str)
   513         """
   520         """
   514         from Domain import deleteAlias
       
   515         self.__dbConnect()
   521         self.__dbConnect()
   516         deleteAlias(self.__dbh, aliasname)
   522         domAlias = DomainAlias(self.__dbh, aliasname, None)
       
   523         domAlias.delete()
   517 
   524 
   518     def domain_list(self, pattern=None):
   525     def domain_list(self, pattern=None):
   519         from Domain import search
   526         from Domain import search
   520         like = False
   527         like = False
   521         if pattern is not None:
   528         if pattern is not None: