VirtualMailManager/domain.py
branchv0.6.x
changeset 379 7518d927d443
parent 366 d6573da35b5f
child 390 660b42391c8e
equal deleted inserted replaced
378:af56cee51e67 379:7518d927d443
   164         if not self._new:
   164         if not self._new:
   165             raise DomErr(_(u"The domain '%s' already exists.") % self._name,
   165             raise DomErr(_(u"The domain '%s' already exists.") % self._name,
   166                          DOMAIN_EXISTS)
   166                          DOMAIN_EXISTS)
   167         assert self._directory is not None and self._transport is not None
   167         assert self._directory is not None and self._transport is not None
   168         dbc = self._dbh.cursor()
   168         dbc = self._dbh.cursor()
   169         dbc.execute("INSERT INTO domain_data VALUES (%s, %s, %s)", (self._gid,
   169         dbc.execute('INSERT INTO domain_data (gid, tid, domaindir) VALUES '
   170                     self._transport.tid, self._directory))
   170                     '(%s, %s, %s)', (self._gid, self._transport.tid,
   171         dbc.execute("INSERT INTO domain_name VALUES (%s, %s, %s)", (self._name,
   171                                      self._directory))
   172                     self._gid, True))
   172         dbc.execute('INSERT INTO domain_name (domainname, gid, is_primary) '
       
   173                     'VALUES (%s, %s, TRUE)', (self._name, self._gid))
   173         self._dbh.commit()
   174         self._dbh.commit()
   174         dbc.close()
   175         dbc.close()
   175         self._new = False
   176         self._new = False
   176 
   177 
   177     def delete(self, force=False):
   178     def delete(self, force=False):