~lutostag/ubuntu/trusty/maas/1.5.4+keystone

« back to all changes in this revision

Viewing changes to src/maasserver/middleware.py

  • Committer: Package Import Robot
  • Author(s): Andres Rodriguez
  • Date: 2012-03-27 14:49:56 UTC
  • mto: (20.1.1 quantal) (1.2.1)
  • mto: This revision was merged to the branch mainline in revision 9.
  • Revision ID: package-import@ubuntu.com-20120327144956-z5stunhc83bnnwsi
Tags: upstream-0.1+bzr363+dfsg
ImportĀ upstreamĀ versionĀ 0.1+bzr363+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
    ABCMeta,
20
20
    abstractproperty,
21
21
    )
 
22
import httplib
22
23
import json
23
24
import logging
24
25
import re
73
74
            reverse('metadata'),
74
75
            # API calls are protected by piston.
75
76
            settings.API_URL_REGEXP,
76
 
            r'^/accounts/[\w]+/sshkeys/$',
77
77
            ]
78
78
        self.public_urls = re.compile("|".join(public_url_roots))
79
79
        self.login_url = reverse('login')
142
142
                    unicode(''.join(exception.messages)).encode(encoding),
143
143
                    mimetype=b"text/plain; charset=%s" % encoding)
144
144
        else:
145
 
            # Do not handle the exception, this will result in a
146
 
            # "Internal Server Error" response.
147
 
            return None
 
145
            # Return an API-readable "Internal Server Error" response.
 
146
            return HttpResponse(
 
147
                content=unicode(exception).encode(encoding),
 
148
                status=httplib.INTERNAL_SERVER_ERROR,
 
149
                mimetype=b"text/plain; charset=%s" % encoding)
148
150
 
149
151
 
150
152
class APIErrorsMiddleware(ExceptionMiddleware):