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 from AliasDomain import AliasDomain |
33 |
33 |
34 SALTCHARS = './0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' |
34 SALTCHARS = './0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' |
35 RE_ASCII_CHARS = """^[\x20-\x7E]*$""" |
35 RE_ASCII_CHARS = """^[\x20-\x7E]*$""" |
36 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}$""" |
37 RE_DOMAIN_SRCH = """^[a-z0-9-\.]+$""" |
37 RE_DOMAIN_SRCH = """^[a-z0-9-\.]+$""" |
494 dom.getAliases()) |
494 dom.getAliases()) |
495 else: |
495 else: |
496 raise VMMDomainException(_(u'Invalid argument: »%s«') % detailed, |
496 raise VMMDomainException(_(u'Invalid argument: »%s«') % detailed, |
497 ERR.INVALID_OPTION) |
497 ERR.INVALID_OPTION) |
498 |
498 |
499 def domainAliasAdd(self, aliasname, domainname): |
499 def aliasDomainAdd(self, aliasname, domainname): |
500 """Adds an alias name to the domain. |
500 """Adds an alias domain to the domain. |
501 |
501 |
502 Keyword arguments: |
502 Keyword arguments: |
503 aliasname -- the alias name of the domain (str) |
503 aliasname -- the name of the alias domain (str) |
504 domainname -- name of the target domain (str) |
504 domainname -- name of the target domain (str) |
505 """ |
505 """ |
506 dom = self.__getDomain(domainname) |
506 dom = self.__getDomain(domainname) |
507 domAlias = DomainAlias(self.__dbh, aliasname, dom) |
507 aliasDom = AliasDomain(self.__dbh, aliasname, dom) |
508 domAlias.save() |
508 aliasDom.save() |
509 |
509 |
510 def domainAliasInfo(self, aliasname): |
510 def aliasDomainInfo(self, aliasname): |
511 self.__dbConnect() |
511 self.__dbConnect() |
512 domAlias = DomainAlias(self.__dbh, aliasname, None) |
512 aliasDom = AliasDomain(self.__dbh, aliasname, None) |
513 return domAlias.info() |
513 return aliasDom.info() |
514 |
514 |
515 def domainAliasDelete(self, aliasname): |
515 def aliasDomainDelete(self, aliasname): |
516 """Deletes the specified alias name. |
516 """Deletes the specified alias domain. |
517 |
517 |
518 Keyword arguments: |
518 Keyword arguments: |
519 aliasname -- the alias name of the domain (str) |
519 aliasname -- the name of the alias domain (str) |
520 """ |
520 """ |
521 self.__dbConnect() |
521 self.__dbConnect() |
522 domAlias = DomainAlias(self.__dbh, aliasname, None) |
522 aliasDom = AliasDomain(self.__dbh, aliasname, None) |
523 domAlias.delete() |
523 aliasDom.delete() |
524 |
524 |
525 def domainList(self, pattern=None): |
525 def domainList(self, pattern=None): |
526 from Domain import search |
526 from Domain import search |
527 like = False |
527 like = False |
528 if pattern is not None: |
528 if pattern is not None: |