[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 6739:
From:       noreply () launchpad ! net
Date:       2009-06-30 3:35:18
Message-ID: 20090630033518.16600.51.launchpad () loganberry ! canonical ! com
[Download RAW message or body]

------------------------------------------------------------
revno: 6739
committer: Barry Warsaw <barry@list.org>
branch nick: 3.0
timestamp: Mon 2009-06-29 23:15:11 -0400
message:
  Add an adapter for IDomain to IAbsoluteURL and add some zope.security onions
  to the varnish.
modified:
  src/mailman/rest/configure.zcml
  src/mailman/rest/docs/domains.txt
  src/mailman/rest/publication.py
  src/mailman/rest/urls.py
  src/mailman/tests/test_documentation.py

=== modified file 'src/mailman/rest/configure.zcml'
--- src/mailman/rest/configure.zcml	2009-06-30 01:30:04 +0000
+++ src/mailman/rest/configure.zcml	2009-06-30 03:15:11 +0000
@@ -12,18 +12,25 @@
   <webservice:register module="mailman.interfaces.domain" />
 
   <adapter
-    for="zope.interface.Interface
-         mailman.rest.webservice.AdminWebServiceRequest"
-    provides="zope.traversing.browser.interfaces.IAbsoluteURL"
-    factory="mailman.rest.urls.AbsoluteURLMapper"
-    />
-
-  <adapter
     for="mailman.config.config.IConfiguration"
     provides="mailman.interfaces.domain.IDomainSet"
     factory="mailman.rest.adapters.DomainSet"
     />
 
+  <adapter
+    for="mailman.interfaces.domain.IDomain
+         mailman.rest.webservice.AdminWebServiceRequest"
+    provides="zope.traversing.browser.interfaces.IAbsoluteURL"
+    factory="mailman.rest.urls.DomainURLMapper"
+    />
+
+  <adapter
+    for="zope.interface.Interface
+         mailman.rest.webservice.AdminWebServiceRequest"
+    provides="zope.traversing.browser.interfaces.IAbsoluteURL"
+    factory="mailman.rest.urls.FallbackURLMapper"
+    />
+
   <utility
     factory="mailman.rest.configuration.AdminWebServiceConfiguration"
     provides="lazr.restful.interfaces.IWebServiceConfiguration">

=== modified file 'src/mailman/rest/docs/domains.txt'
--- src/mailman/rest/docs/domains.txt	2009-06-30 01:30:04 +0000
+++ src/mailman/rest/docs/domains.txt	2009-06-30 03:15:11 +0000
@@ -5,4 +5,15 @@
 The REST API can be queried for the set of known domains.
 
     >>> dump_json('http://localhost:8001/3.0/domains')
-    XXX
+    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
+    resource_type_link: https://localhost:8001/3.0/#domains
+    start: 0
+    total_size: 1

=== modified file 'src/mailman/rest/publication.py'
--- src/mailman/rest/publication.py	2009-05-25 20:27:05 +0000
+++ src/mailman/rest/publication.py	2009-06-30 03:15:11 +0000
@@ -48,7 +48,8 @@
 
     def beforeTraversal(self, request):
         """See `IPublication`."""
-        pass
+        endInteraction()
+        newInteraction(request)
 
     def getApplication(self, request):
         """See `IPublication`."""

=== modified file 'src/mailman/rest/urls.py'
--- src/mailman/rest/urls.py	2009-06-30 01:46:20 +0000
+++ src/mailman/rest/urls.py	2009-06-30 03:15:11 +0000
@@ -15,13 +15,14 @@
 # You should have received a copy of the GNU General Public License along with
 # GNU Mailman.  If not, see <http://www.gnu.org/licenses/>.
 
-"""Module stuff."""
+"""Mappers from objects to absolute URLs."""
 
 from __future__ import absolute_import, unicode_literals
 
 __metaclass__ = type
 __all__ = [
     'AbsoluteURLMapper',
+    'DomainURLMapper',
     ]
 
 
@@ -36,8 +37,8 @@
 
 
 
-class AbsoluteURLMapper:
-    """Generic absolute url mapper."""
+class BasicURLMapper:
+    """Base absolute URL mapper."""
 
     implements(IAbsoluteURL)
 
@@ -51,6 +52,11 @@
         self.hostname = config.webservice.hostname
         self.port = int(config.webservice.port)
 
+
+
+class FallbackURLMapper(BasicURLMapper):
+    """Generic absolute url mapper."""
+
     def __call__(self):
         """Return the semi-hard-coded URL to the service root."""
         path = self._lookup(self.context)
@@ -73,3 +79,16 @@
             system: 'system',
             }
         return urls[ob]
+
+
+
+class DomainURLMapper(BasicURLMapper):
+    """Mapper of `IDomains` to `IAbsoluteURL`."""
+
+    implements(IAbsoluteURL)
+
+    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)
+        

=== modified file 'src/mailman/tests/test_documentation.py'
--- src/mailman/tests/test_documentation.py	2009-05-27 15:44:10 +0000
+++ src/mailman/tests/test_documentation.py	2009-06-30 03:15:11 +0000
@@ -119,7 +119,14 @@
     finally:
         fp.close()
     for key in sorted(data):
-        print '{0}: {1}'.format(key, data[key])
+        if key == 'entries':
+            for i, entry in enumerate(data[key]):
+                # entry is a dictionary.
+                print 'entry %d:' % i
+                for entry_key in sorted(entry):
+                    print '    {0}: {1}'.format(entry_key, entry[entry_key])
+        else:
+            print '{0}: {1}'.format(key, data[key])
 
 
 



--
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