equal
deleted
inserted
replaced
156 for t in ('alias','users','relocated','domain_name','domain_data'): |
156 for t in ('alias','users','relocated','domain_name','domain_data'): |
157 dbc.execute("DELETE FROM %s WHERE gid = %d" % (t, self._id)) |
157 dbc.execute("DELETE FROM %s WHERE gid = %d" % (t, self._id)) |
158 self._dbh.commit() |
158 self._dbh.commit() |
159 dbc.close() |
159 dbc.close() |
160 else: |
160 else: |
161 raise VMMDE(_(u"The domain “%s” doesn't exist yet.") % self._name, |
161 raise VMMDE(_(u"The domain “%s” doesn't exist.") % self._name, |
162 ERR.NO_SUCH_DOMAIN) |
162 ERR.NO_SUCH_DOMAIN) |
163 |
163 |
164 def updateTransport(self, transport, force=False): |
164 def updateTransport(self, transport, force=False): |
165 """Sets a new transport for the domain. |
165 """Sets a new transport for the domain. |
166 |
166 |
182 trsp.getID(), self._id) |
182 trsp.getID(), self._id) |
183 if dbc.rowcount > 0: |
183 if dbc.rowcount > 0: |
184 self._dbh.commit() |
184 self._dbh.commit() |
185 dbc.close() |
185 dbc.close() |
186 else: |
186 else: |
187 raise VMMDE(_(u"The domain “%s” doesn't exist yet.") % self._name, |
187 raise VMMDE(_(u"The domain “%s” doesn't exist.") % self._name, |
188 ERR.NO_SUCH_DOMAIN) |
188 ERR.NO_SUCH_DOMAIN) |
189 |
189 |
190 def getID(self): |
190 def getID(self): |
191 """Returns the ID of the domain.""" |
191 """Returns the ID of the domain.""" |
192 return self._id |
192 return self._id |
213 dbc = self._dbh.cursor() |
213 dbc = self._dbh.cursor() |
214 dbc.execute(sql) |
214 dbc.execute(sql) |
215 info = dbc.fetchone() |
215 info = dbc.fetchone() |
216 dbc.close() |
216 dbc.close() |
217 if info is None: |
217 if info is None: |
218 raise VMMDE(_(u"The domain “%s” doesn't exist yet.") % self._name, |
218 raise VMMDE(_(u"The domain “%s” doesn't exist.") % self._name, |
219 ERR.NO_SUCH_DOMAIN) |
219 ERR.NO_SUCH_DOMAIN) |
220 else: |
220 else: |
221 keys = ['gid', 'domainname', 'transport', 'domaindir', |
221 keys = ['gid', 'domainname', 'transport', 'domaindir', |
222 'aliasdomains', 'accounts', 'aliases', 'relocated'] |
222 'aliasdomains', 'accounts', 'aliases', 'relocated'] |
223 return dict(zip(keys, info)) |
223 return dict(zip(keys, info)) |