Skip to content

Commit

Permalink
Tie current service to subrequests on error
Browse files Browse the repository at this point in the history
  • Loading branch information
leplatrem committed Feb 1, 2016
1 parent 9820583 commit 4a4dba9
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion kinto/plugins/default_bucket/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
from pyramid.security import NO_PERMISSION_REQUIRED

from cliquet.errors import raise_invalid
from cliquet.utils import build_request, reapply_cors, hmac_digest
from cliquet.utils import (build_request, reapply_cors, hmac_digest,
current_service)
from cliquet.storage import exceptions as storage_exceptions

from kinto.authorization import RouteFactory
Expand Down Expand Up @@ -120,6 +121,14 @@ def default_bucket(request):
try:
response = request.invoke_subrequest(subrequest)
except httpexceptions.HTTPException as error:
# Tie default bucket view with underlying Cliquet service.
# This helps Cliquet to detect the default bucket requests as if
# they were issued on the underlying resource.
# (ref #mozilla-services/cliquet#631)
pattern = request.matched_route.pattern
service = current_service(subrequest)
request.registry.cornice_services[pattern] = service

if error.content_type == 'application/json':
response = reapply_cors(subrequest, error)
else:
Expand Down

0 comments on commit 4a4dba9

Please sign in to comment.