296 |
296 |
297 def get_info(self): |
297 def get_info(self): |
298 """Returns a dictionary with information about the domain.""" |
298 """Returns a dictionary with information about the domain.""" |
299 self._chk_state() |
299 self._chk_state() |
300 dbc = self._dbh.cursor() |
300 dbc = self._dbh.cursor() |
301 dbc.execute('SELECT gid, domainname, transport, domaindir, ' |
301 dbc.execute('SELECT aliasdomains, accounts, aliases, relocated ' |
302 'aliasdomains, accounts, aliases, relocated, bytes, ' |
302 'FROM vmm_domain_info WHERE gid = %s', (self._gid,)) |
303 'messages FROM vmm_domain_info WHERE gid = %s', |
|
304 (self._gid,)) |
|
305 info = dbc.fetchone() |
303 info = dbc.fetchone() |
306 dbc.close() |
304 dbc.close() |
307 keys = ('gid', 'domainname', 'transport', 'domaindir', 'aliasdomains', |
305 keys = ('aliasdomains', 'accounts', 'aliases', 'relocated') |
308 'accounts', 'aliases', 'relocated', 'bytes', 'messages') |
306 info = dict(zip(keys, info)) |
309 return dict(zip(keys, info)) |
307 info['gid'] = self._gid |
|
308 info['domainname'] = self._name |
|
309 info['transport'] = self._transport.transport |
|
310 info['domaindir'] = self._directory |
|
311 info['bytes'] = self._qlimit.bytes |
|
312 info['messages'] = self._qlimit.messages |
|
313 return info |
310 |
314 |
311 def get_accounts(self): |
315 def get_accounts(self): |
312 """Returns a list with all accounts of the domain.""" |
316 """Returns a list with all accounts of the domain.""" |
313 self._chk_state() |
317 self._chk_state() |
314 dbc = self._dbh.cursor() |
318 dbc = self._dbh.cursor() |