diff options
| author | Barry Warsaw | 2009-07-25 00:23:01 -0400 |
|---|---|---|
| committer | Barry Warsaw | 2009-07-25 00:23:01 -0400 |
| commit | 9c5c394a0912b56dd0fa1cabe07833aca24b92ef (patch) | |
| tree | 05a626a418ba364d64c2da54f0f91b6bf3001e25 /src/mailman/rest/urls.py | |
| parent | 95163b905be9c912f640b07353451013bd6020a7 (diff) | |
| download | mailman-9c5c394a0912b56dd0fa1cabe07833aca24b92ef.tar.gz mailman-9c5c394a0912b56dd0fa1cabe07833aca24b92ef.tar.zst mailman-9c5c394a0912b56dd0fa1cabe07833aca24b92ef.zip | |
Diffstat (limited to 'src/mailman/rest/urls.py')
| -rw-r--r-- | src/mailman/rest/urls.py | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/src/mailman/rest/urls.py b/src/mailman/rest/urls.py index 38f676c7f..f1677421d 100644 --- a/src/mailman/rest/urls.py +++ b/src/mailman/rest/urls.py @@ -21,8 +21,8 @@ from __future__ import absolute_import, unicode_literals __metaclass__ = type __all__ = [ - 'AbsoluteURLMapper', 'DomainURLMapper', + 'MailingListURLMapper', ] @@ -82,19 +82,35 @@ class FallbackURLMapper(BasicURLMapper): return '' urls = { system: 'system', - #config.db.list_manager: 'lists', + config.db.list_manager: 'lists', } return urls[ob] -class DomainURLMapper(BasicURLMapper): - """Mapper of `IDomains` to `IAbsoluteURL`.""" +class TopLevelURLMapper(BasicURLMapper): + """A simple mapper for top level objects.""" implements(IAbsoluteURL) + format_string = None + def __call__(self): - """Return the hard-coded URL to the domain.""" - return ('{0.schema}://{0.hostname}:{0.port}/{0.version}/domains/' - '{1.email_host}').format(self, self.context) - + """Return the hard-coded URL to the resource.""" + return self.format_string.format(self) + + +class DomainURLMapper(TopLevelURLMapper): + """Mapper of `IDomains` to `IAbsoluteURL`.""" + + format_string = ( + '{0.schema}://{0.hostname}:{0.port}/{0.version}/' + 'domains/{0.context.email_host}') + + +class MailingListURLMapper(TopLevelURLMapper): + """Mapper of `IMailingList` to `IAbsoluteURL`.""" + + format_string = ( + '{0.schema}://{0.hostname}:{0.port}/{0.version}/' + 'mailing_lists/{0.context.fqdn_listname}') |
