Unverified Commit 7deebbcc authored by Kali Kaneko's avatar Kali Kaneko
Browse files

[bug] rename mail get-token commands

otherwise the command cannot be dispatched.
return dicts instead of strings too.
parent c8520be5
......@@ -31,10 +31,10 @@ SUBCOMMANDS:
enable Start service
disable Stop service
status Display status about service
get-token Returns token for the mail service
get-smtp-certificate Downloads a new smtp certificate
get_token Returns token for the mail service
get_smtp_certificate Downloads a new smtp certificate
'''.format(name=command.appname)
commands = ['enable', 'disable', 'status', 'get-token',
'get-smtp-certificate']
commands = ['enable', 'disable', 'status', 'get_token',
'get_smtp_certificate']
......@@ -35,7 +35,7 @@ class SubCommand(object):
_method = getattr(self, 'do_' + subcmd.upper(), None)
if not _method:
raise RuntimeError('No such subcommand')
return _method(service, *parts, **kw)
return defer.maybeDeferred(_method, service, *parts, **kw)
class UserCmd(SubCommand):
......@@ -105,6 +105,7 @@ class MailCmd(SubCommand):
@register_method('dict')
def do_ENABLE(self, service, *parts, **kw):
# FIXME -- service doesn't have this method
d = service.do_enable_service(self.label)
return d
......
......@@ -459,15 +459,15 @@ class StandardMailService(service.MultiService, HookableService):
# commands
def do_status(self):
return 'mail: %s' % 'running' if self.running else 'disabled'
status = 'running' if self.running else 'disabled'
return {'mail': status}
def get_token(self):
active_user = self._active_user
if not active_user:
return defer.succeed('NO ACTIVE USER')
return defer.succeed({'user': None})
token = self._service_tokens.get(active_user)
# TODO return just the tuple, no format.
return defer.succeed("MAIL TOKEN (%s): %s" % (active_user, token))
return defer.succeed({'user': active_user, 'token': token})
def do_get_smtp_cert_path(self, userid):
username, provider = userid.split('@')
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment