diff options
| author | Barry Warsaw | 2010-02-16 17:34:44 -0500 |
|---|---|---|
| committer | Barry Warsaw | 2010-02-16 17:34:44 -0500 |
| commit | 24631a0aad7c1be8b71303b509552f69240743b5 (patch) | |
| tree | f3152f2965644adec8fb2c17e01f3bd43e89d286 /src | |
| parent | cf6e714bc3c68a8b9d788370fbdee4df6764e936 (diff) | |
| download | mailman-24631a0aad7c1be8b71303b509552f69240743b5.tar.gz mailman-24631a0aad7c1be8b71303b509552f69240743b5.tar.zst mailman-24631a0aad7c1be8b71303b509552f69240743b5.zip | |
Diffstat (limited to 'src')
| -rw-r--r-- | src/mailman/rest/configure.zcml | 6 | ||||
| -rw-r--r-- | src/mailman/rest/urls.py | 7 | ||||
| -rw-r--r-- | src/mailman/rest/webservice.py | 35 |
3 files changed, 31 insertions, 17 deletions
diff --git a/src/mailman/rest/configure.zcml b/src/mailman/rest/configure.zcml index 7fecf4608..6e8b3727d 100644 --- a/src/mailman/rest/configure.zcml +++ b/src/mailman/rest/configure.zcml @@ -34,6 +34,12 @@ factory="mailman.rest.urls.FallbackURLMapper" /> + <!-- + XXX 2010-02-16 barry Why is this necessary? Without this, lazr.restful + does not adapt the ISystem to the FallbackURLMapper. I don't know why + that happens because the above generic mapper should do the trick. + --> + <adapter for="mailman.interfaces.system.ISystem lazr.restful.simple.Request" diff --git a/src/mailman/rest/urls.py b/src/mailman/rest/urls.py index 1d7adc0dd..566696f82 100644 --- a/src/mailman/rest/urls.py +++ b/src/mailman/rest/urls.py @@ -55,6 +55,13 @@ class BasicURLMapper: self.context = context self.request = request self.webservice_config = AdminWebServiceConfiguration() + # XXX 2010-02-16 barry This kind of sucks, but I don't understand how + # to reconcile the way we used to do things with the way lazr.restful + # as of 0.9.18 wants to do multiversion webservices. And really, I + # don't care because right now I don't have any need for + # multiversioned services. lazr.restful forced me to think about it + # though, so this just hardcodes the version part of the resource URL + # path to the first (i.e. numbered) version. self.version = self.webservice_config.active_versions[0] self.schema = ('https' if self.webservice_config.use_https else 'http') self.hostname = self.webservice_config.hostname diff --git a/src/mailman/rest/webservice.py b/src/mailman/rest/webservice.py index e30ac856d..5c42635cb 100644 --- a/src/mailman/rest/webservice.py +++ b/src/mailman/rest/webservice.py @@ -58,6 +58,11 @@ log = logging.getLogger('mailman.http') # Marker interfaces for multiversion lazr.restful. +# +# XXX 2010-02-16 barry Gah! lazr.restful's multiversion.txt document says +# these classes should get generated, and the registrations should happen, +# automatically. This is not the case AFAICT. Why?! + class I30Version(IWebServiceClientRequest): pass @@ -72,25 +77,18 @@ class AdminWebServiceRootResource(RootResource): implements(IResolvePathNames) - def __init__(self): - # We can't build these mappings at construction time. - self._collections = None - self._entry_links = None - self._top_names = None - + # XXX 2010-02-16 barry lazr.restful really wants this class to exist and + # be a subclass of RootResource. Our own traversal really wants this to + # implement IResolvePathNames. RootResource says to override + # _build_top_level_objects() to return the top-level objects, but that + # appears to never be called by lazr.restful, so you've got me. I don't + # understand this, which sucks, so just ensure that it doesn't do anything + # useful so if/when I do understand this, I can resolve the conflict + # between the way lazr.restful wants us to do things and the way our + # traversal wants to do things. def _build_top_level_objects(self): """See `RootResource`.""" - self._collections = dict( - domains=(IDomain, getUtility(IDomainCollection)), - lists=(IMailingList, getUtility(IListManager)), - members=(IMember, getUtility(ISubscriptionService)), - ) - self._entry_links = dict( - system=system, - ) - self._top_names = self._collection.copy() - self._top_names.update(self._entry_links) - return (self._collections, self._entry_links) + raise NotImplementedError('Magic suddenly got invoked') def get(self, name): """See `IResolvePathNames`.""" @@ -121,6 +119,9 @@ class AdminWebServiceWSGIRequestHandler(WSGIRequestHandler): def make_server(): """Create the WSGI admin REST server.""" + # XXX 2010-02-16 barry Gah! lazr.restful's multiversion.txt document says + # these classes should get generated, and the registrations should happen, + # automatically. This is not the case AFAICT. Why?! register_versioned_request_utility(I30Version, '3.0') register_versioned_request_utility(IDevVersion, 'dev') host = config.webservice.hostname |
