------------------------------------------------------------
revno: 6760
committer: Barry Warsaw <[email protected]>
branch nick: 3.0
timestamp: Fri 2009-08-07 23:46:41 -0400
message:
  Fix some urls returned by the api.  Instead of 'mailing_lists' use 'lists'.
  
  Also, extend the ListManager so that it implements IResolvePathNames, so that
  it can get() sub-mailing lists.
modified:
  src/mailman/database/listmanager.py
  src/mailman/interfaces/mailinglist.py
  src/mailman/rest/docs/lists.txt
  src/mailman/rest/urls.py


--
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.
=== modified file 'src/mailman/database/listmanager.py'
--- src/mailman/database/listmanager.py	2009-07-27 01:23:02 +0000
+++ src/mailman/database/listmanager.py	2009-08-08 03:46:41 +0000
@@ -32,13 +32,14 @@
 from mailman.config import config
 from mailman.database.mailinglist import MailingList
 from mailman.interfaces.listmanager import IListManager, ListAlreadyExistsError
+from mailman.interfaces.rest import IResolvePathNames
 
 
 
 class ListManager(object):
     """An implementation of the `IListManager` interface."""
 
-    implements(IListManager)
+    implements(IListManager, IResolvePathNames)
 
     # pylint: disable-msg=R0201
     def create(self, fqdn_listname):

=== modified file 'src/mailman/interfaces/mailinglist.py'
--- src/mailman/interfaces/mailinglist.py	2009-07-25 04:23:01 +0000
+++ src/mailman/interfaces/mailinglist.py	2009-08-08 03:46:41 +0000
@@ -71,7 +71,10 @@
 class IMailingList(Interface):
     """A mailing list."""
 
-    export_as_webservice_entry()
+    # Use a different singular and plural name for the resource type than
+    # lazr.restful gives it as a default (which is normally taken from the
+    # interface name).
+    export_as_webservice_entry('list', 'lists')
 
     # List identity
 

=== modified file 'src/mailman/rest/docs/lists.txt'
--- src/mailman/rest/docs/lists.txt	2009-08-06 21:05:53 +0000
+++ src/mailman/rest/docs/lists.txt	2009-08-08 03:46:41 +0000
@@ -7,7 +7,7 @@
 yet though.
 
     >>> dump_json('http://localhost:8001/3.0/lists')
-    resource_type_link: http://localhost:8001/3.0/#mailing_lists
+    resource_type_link: http://localhost:8001/3.0/#lists
     start: None
     total_size: 0
 
@@ -25,9 +25,9 @@
         http_etag: "..."
         list_name: test-one
         real_name: Test-one
-        resource_type_link: http://localhost:8001/3.0/#mailing_list
-        self_link: http://localhost:8001/3.0/mailing_lists/[email protected]
-    resource_type_link: http://localhost:8001/3.0/#mailing_lists
+        resource_type_link: http://localhost:8001/3.0/#list
+        self_link: http://localhost:8001/3.0/lists/[email protected]
+    resource_type_link: http://localhost:8001/3.0/#lists
     start: 0
     total_size: 1
 
@@ -36,8 +36,8 @@
 ==========================
 
 New mailing lists can also be created through the API, by posting to the
-'mailing_lists' URL.  However lazr.restful requires us to use a 'named
-operation' instead of posting directly to the URL.
+'lists' URL.  However lazr.restful requires us to use a 'named operation'
+instead of posting directly to the URL.
 
     >>> dump_json('http://localhost:8001/3.0/lists', {
     ...           'ws.op': 'new',
@@ -47,7 +47,7 @@
     content-length: 0
     content-type: text/plain
     date: ...
-    location: http://localhost:8001/3.0/mailing_lists/[email protected]
+    location: http://localhost:8001/3.0/lists/[email protected]
     server: WSGIServer/... Python/...
     x-content-type-warning: guessed from content
     x-powered-by: Zope (www.zope.org), Python (www.python.org)
@@ -57,6 +57,21 @@
     >>> config.db.list_manager.get('[email protected]')
     <mailing list "[email protected]" at ...>
 
+    # The above starts a Storm transaction, which will lock the database
+    # unless we abort it.
+    >>> transaction.abort()
+
+It is also available via the location given in the response.
+
+    >>> dump_json('http://localhost:8001/3.0/lists/[email protected]')
+    fqdn_listname: [email protected]
+    host_name: example.com
+    http_etag: "..."
+    list_name: test-two
+    real_name: Test-two
+    resource_type_link: http://localhost:8001/3.0/#list
+    self_link: http://localhost:8001/3.0/lists/[email protected]
+
 However, you are not allowed to create a mailing list in a domain that does
 not exist.
 

=== modified file 'src/mailman/rest/urls.py'
--- src/mailman/rest/urls.py	2009-08-07 00:13:23 +0000
+++ src/mailman/rest/urls.py	2009-08-08 03:46:41 +0000
@@ -112,4 +112,4 @@
 
     format_string = (
         '{0.schema}://{0.hostname}:{0.port}/{0.version}/'
-        'mailing_lists/{0.context.fqdn_listname}')
+        'lists/{0.context.fqdn_listname}')

_______________________________________________
Mailman-checkins mailing list
[email protected]
Unsubscribe: 
http://mail.python.org/mailman/options/mailman-checkins/archive%40jab.org

Reply via email to