VirtualMailManager/domain.py
changeset 615 5882bfdf83e8
parent 611 8e9b0046bc8f
child 637 ca6621caff2f
child 675 d24f094d1cb5
equal deleted inserted replaced
614:1ec3497a6733 615:5882bfdf83e8
    13 from random import choice
    13 from random import choice
    14 
    14 
    15 from VirtualMailManager.constants import \
    15 from VirtualMailManager.constants import \
    16      ACCOUNT_AND_ALIAS_PRESENT, DOMAIN_ALIAS_EXISTS, DOMAIN_EXISTS, \
    16      ACCOUNT_AND_ALIAS_PRESENT, DOMAIN_ALIAS_EXISTS, DOMAIN_EXISTS, \
    17      DOMAIN_INVALID, DOMAIN_TOO_LONG, NO_SUCH_DOMAIN, VMM_ERROR
    17      DOMAIN_INVALID, DOMAIN_TOO_LONG, NO_SUCH_DOMAIN, VMM_ERROR
       
    18 from VirtualMailManager.common import validate_transport
    18 from VirtualMailManager.errors import VMMError, DomainError as DomErr
    19 from VirtualMailManager.errors import VMMError, DomainError as DomErr
       
    20 from VirtualMailManager.maillocation import MailLocation
    19 from VirtualMailManager.pycompat import all, any
    21 from VirtualMailManager.pycompat import all, any
    20 from VirtualMailManager.quotalimit import QuotaLimit
    22 from VirtualMailManager.quotalimit import QuotaLimit
    21 from VirtualMailManager.serviceset import ServiceSet
    23 from VirtualMailManager.serviceset import ServiceSet
    22 from VirtualMailManager.transport import Transport
    24 from VirtualMailManager.transport import Transport
    23 
    25 
   245         `transport` : VirtualMailManager.Transport
   247         `transport` : VirtualMailManager.Transport
   246           The transport of the new Domain
   248           The transport of the new Domain
   247         """
   249         """
   248         self._chk_state(False)
   250         self._chk_state(False)
   249         assert isinstance(transport, Transport)
   251         assert isinstance(transport, Transport)
       
   252         validate_transport(transport,
       
   253                            MailLocation(self._dbh,
       
   254                                         mbfmt=cfg_dget('mailbox.format'),
       
   255                                         directory=cfg_dget('mailbox.root')))
   250         self._transport = transport
   256         self._transport = transport
   251 
   257 
   252     def set_note(self, note):
   258     def set_note(self, note):
   253         """Set the domain's (optional) note.
   259         """Set the domain's (optional) note.
   254 
   260 
   365         """
   371         """
   366         self._chk_state()
   372         self._chk_state()
   367         assert isinstance(transport, Transport)
   373         assert isinstance(transport, Transport)
   368         if not force and transport == self._transport:
   374         if not force and transport == self._transport:
   369             return
   375             return
       
   376         validate_transport(transport,
       
   377                            MailLocation(self._dbh,
       
   378                                         mbfmt=cfg_dget('mailbox.format'),
       
   379                                         directory=cfg_dget('mailbox.root')))
   370         self._update_tables_ref('tid', transport.tid, force)
   380         self._update_tables_ref('tid', transport.tid, force)
   371         self._transport = transport
   381         self._transport = transport
   372 
   382 
   373     def update_note(self, note):
   383     def update_note(self, note):
   374         """Sets a new note for the Domain.
   384         """Sets a new note for the Domain.