summaryrefslogtreecommitdiff
path: root/src/mailman/commands/cli_info.py
diff options
context:
space:
mode:
authorBarry Warsaw2016-01-13 11:16:38 -0500
committerBarry Warsaw2016-01-13 11:16:38 -0500
commit98c074f19492d81ebf5b5c3f4d4f2210aa56230d (patch)
tree8a04bc455fe21065c38ccd05e3141d3f24d0d816 /src/mailman/commands/cli_info.py
parentd75a7ebb46279f341b498bf517d07e9ae4c27f0a (diff)
downloadmailman-98c074f19492d81ebf5b5c3f4d4f2210aa56230d.tar.gz
mailman-98c074f19492d81ebf5b5c3f4d4f2210aa56230d.tar.zst
mailman-98c074f19492d81ebf5b5c3f4d4f2210aa56230d.zip
Refactor API differences into a separate class.
We now have an IAPI interface which defines methods to convert to/from UUIDs to their REST representations, and to calculate the API-homed full URL path to a resource. Add implementations API30 and API31 to handle the two different implementations so far. This also simplifies the various path_to() calls. Also: Add support for diff_cover to tox.ini to check that all differences against the master branch have full test coverage.
Diffstat (limited to 'src/mailman/commands/cli_info.py')
-rw-r--r--src/mailman/commands/cli_info.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/mailman/commands/cli_info.py b/src/mailman/commands/cli_info.py
index 757c02a3f..76e8e55da 100644
--- a/src/mailman/commands/cli_info.py
+++ b/src/mailman/commands/cli_info.py
@@ -26,9 +26,9 @@ import sys
from lazr.config import as_boolean
from mailman.config import config
+from mailman.core.api import API30, API31
from mailman.core.i18n import _
from mailman.interfaces.command import ICLISubCommand
-from mailman.rest.helpers import path_to
from mailman.version import MAILMAN_VERSION_FULL
from zope.interface import implementer
@@ -68,9 +68,8 @@ class Info:
print('devmode:',
'ENABLED' if as_boolean(config.devmode.enabled) else 'DISABLED',
file=output)
- print('REST root url:',
- path_to('/', config.webservice.api_version),
- file=output)
+ api = (API30 if config.webservice.api_version == '3.0' else API31)
+ print('REST root url:', api.path_to('/'), file=output)
print('REST credentials: {0}:{1}'.format(
config.webservice.admin_user, config.webservice.admin_pass),
file=output)