~hudson-openstack/burrow/trunk

« back to all changes in this revision

Viewing changes to burrow/frontend/wsgi.py

  • Committer: Tarmac
  • Author(s): Eric Day
  • Date: 2011-08-24 20:23:03 UTC
  • mfrom: (33.1.7 doc-updates)
  • Revision ID: tarmac-20110824202303-fc09r0aendi1tn6m
Added client API unit tests, moved exceptions to main burrow module, and added more WSGI frontend tests.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
import routes.middleware
22
22
import webob.dec
23
23
 
24
 
import burrow.backend
25
24
import burrow.frontend
26
25
 
27
26
# Default configuration values for this module.
101
100
            args['attributes'] = self._parse_attributes(req)
102
101
        method = getattr(self.backend, '%s_%s' % (method, action), None)
103
102
        if method is None:
104
 
            return self._response(status=400)
 
103
            return self._response(status=405)
105
104
        args['filters'] = self._parse_filters(req)
106
105
        return self._response(body=lambda: method(**args))
107
106
 
187
186
                body = body()
188
187
            if isinstance(body, types.GeneratorType):
189
188
                body = list(body)
190
 
        except burrow.backend.InvalidArguments:
 
189
        except burrow.InvalidArguments, exception:
191
190
            status = 400
192
 
            body = None
193
 
        except burrow.backend.NotFound:
 
191
            body = exception.message
 
192
        except burrow.NotFound, exception:
194
193
            status = 404
195
 
            body = None
 
194
            body = exception.message
196
195
        if body == []:
197
196
            body = None
198
197
        return status, body