VirtualMailManager/domain.py
branchv0.6.x
changeset 363 502d59f4bb34
parent 352 22d115376e4d
child 366 d6573da35b5f
equal deleted inserted replaced
362:c2e8eab2616d 363:502d59f4bb34
   130         Argument:
   130         Argument:
   131 
   131 
   132         `basedir` : basestring
   132         `basedir` : basestring
   133           The base directory of all domains
   133           The base directory of all domains
   134         """
   134         """
   135         assert self._new and self._directory is None
   135         if not self._new:
       
   136             raise DomErr(_(u"The domain '%s' already exists.") % self._name,
       
   137                          DOMAIN_EXISTS)
       
   138         assert self._directory is None
   136         self._set_gid()
   139         self._set_gid()
   137         self._directory = os.path.join(basedir, choice(MAILDIR_CHARS),
   140         self._directory = os.path.join(basedir, choice(MAILDIR_CHARS),
   138                                        str(self._gid))
   141                                        str(self._gid))
   139 
   142 
   140     @property
   143     @property
   148         Argument:
   151         Argument:
   149 
   152 
   150         `transport` : VirtualMailManager.Transport
   153         `transport` : VirtualMailManager.Transport
   151           The transport of the new Domain
   154           The transport of the new Domain
   152         """
   155         """
   153         assert self._new and isinstance(transport, Transport)
   156         if not self._new:
       
   157             raise DomErr(_(u"The domain '%s' already exists.") % self._name,
       
   158                          DOMAIN_EXISTS)
       
   159         assert isinstance(transport, Transport)
   154         self._transport = transport
   160         self._transport = transport
   155 
   161 
   156     def save(self):
   162     def save(self):
   157         """Stores the new domain in the database."""
   163         """Stores the new domain in the database."""
   158         if not self._new:
   164         if not self._new: