[prev in list] [next in list] [prev in thread] [next in thread]
List: mailman-cvs
Subject: [Mailman-checkins] [Branch ~mailman-coders/mailman/3.0] Rev 6740:
From: noreply () launchpad ! net
Date: 2009-06-30 3:35:18
Message-ID: 20090630033518.16600.25617.launchpad () loganberry ! canonical ! com
[Download RAW message or body]
------------------------------------------------------------
revno: 6740
committer: Barry Warsaw <barry@list.org>
branch nick: 3.0
timestamp: Mon 2009-06-29 23:31:51 -0400
message:
Implement returning multiple domains, a single specific domain, and raising a
404 if the named domain is missing.
modified:
src/mailman/rest/adapters.py
src/mailman/rest/docs/domains.txt
=== modified file 'src/mailman/rest/adapters.py'
--- src/mailman/rest/adapters.py 2009-06-30 01:30:04 +0000
+++ src/mailman/rest/adapters.py 2009-06-30 03:31:51 +0000
@@ -26,15 +26,17 @@
from zope.interface import implements
+from zope.publisher.interfaces import NotFound
from mailman.interfaces.domain import IDomainSet
+from mailman.interfaces.rest import IResolvePathNames
class DomainSet:
"""Sets of known domains."""
- implements(IDomainSet)
+ implements(IDomainSet, IResolvePathNames)
__name__ = 'domains'
@@ -45,3 +47,10 @@
"""See `IDomainSet`."""
domains = self._config.domains
return [domains[domain] for domain in sorted(domains)]
+
+ def get(self, name):
+ """See `IResolvePathNames`."""
+ domain = self._config.domains.get(name)
+ if domain is None:
+ raise NotFound(self, name)
+ return domain
=== modified file 'src/mailman/rest/docs/domains.txt'
--- src/mailman/rest/docs/domains.txt 2009-06-30 03:15:11 +0000
+++ src/mailman/rest/docs/domains.txt 2009-06-30 03:31:51 +0000
@@ -17,3 +17,80 @@
resource_type_link: https://localhost:8001/3.0/#domains
start: 0
total_size: 1
+
+All domains are returned.
+
+ >>> from mailman.config import config
+ >>> config.push('test domains', """\
+ ... [domain.example_dot_org]
+ ... email_host: example.org
+ ... base_url: http://mail.example.org
+ ... contact_address: listmaster@example.org
+ ...
+ ... [domain.example_dot_net]
+ ... email_host: lists.example.net
+ ... base_url: http://example.net
+ ... contact_address: porkmaster@example.net
+ ... """)
+
+ >>> dump_json('http://localhost:8001/3.0/domains')
+ entry 0:
+ base_url: http://lists.example.com
+ contact_address: postmaster@example.com
+ description: An example domain.
+ email_host: example.com
+ http_etag: "546791f38192b347db544481f1386d33607ccf3d"
+ resource_type_link: https://localhost:8001/3.0/#domain
+ self_link: https://localhost:8001/3.0/domains/example.com
+ url_host: lists.example.com
+ entry 1:
+ base_url: http://mail.example.org
+ contact_address: listmaster@example.org
+ description: An example domain.
+ email_host: example.org
+ http_etag: "4ff00fefca81b99ce2c7e6c50223107daf0649ff"
+ resource_type_link: https://localhost:8001/3.0/#domain
+ self_link: https://localhost:8001/3.0/domains/example.org
+ url_host: mail.example.org
+ entry 2:
+ base_url: http://example.net
+ contact_address: porkmaster@example.net
+ description: An example domain.
+ email_host: lists.example.net
+ http_etag: "aa5a388197948f21b8a3eb940b6c9725c5f41fac"
+ resource_type_link: https://localhost:8001/3.0/#domain
+ self_link: https://localhost:8001/3.0/domains/lists.example.net
+ url_host: example.net
+ resource_type_link: https://localhost:8001/3.0/#domains
+ start: 0
+ total_size: 3
+
+
+Individual domains
+==================
+
+The information for a single domain is available by following one of the
+self_links from the above collection.
+
+ >>> dump_json('http://localhost:8001/3.0/domains/lists.example.net')
+ base_url: http://example.net
+ contact_address: porkmaster@example.net
+ description: An example domain.
+ email_host: lists.example.net
+ http_etag: "aa5a388197948f21b8a3eb940b6c9725c5f41fac"
+ resource_type_link: https://localhost:8001/3.0/#domain
+ self_link: https://localhost:8001/3.0/domains/lists.example.net
+ url_host: example.net
+
+But we get a 404 for a non-existent domain.
+
+ >>> dump_json('http://localhost:8001/3.0/domains/does-not-exist')
+ Traceback (most recent call last):
+ ...
+ HTTPError: HTTP Error 404: Not Found
+
+
+Clean up
+========
+
+ >>> config.pop('test domains')
--
lp:mailman
https://code.launchpad.net/~mailman-coders/mailman/3.0
Your team Mailman Checkins is subscribed to branch lp:mailman.
To unsubscribe from this branch go to \
https://code.launchpad.net/~mailman-coders/mailman/3.0/+edit-subscription. \
_______________________________________________ Mailman-checkins mailing list
Mailman-checkins@python.org
Unsubscribe: http://mail.python.org/mailman/options/mailman-checkins/mailman-cvs%40progressive-comp.com
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic