diff options
Diffstat (limited to 'gluster/swift/obj/server.py')
-rw-r--r-- | gluster/swift/obj/server.py | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/gluster/swift/obj/server.py b/gluster/swift/obj/server.py index 6417475..3cdd3c0 100644 --- a/gluster/swift/obj/server.py +++ b/gluster/swift/obj/server.py @@ -1,4 +1,4 @@ -# Copyright (c) 2012-2013 Red Hat, Inc. +# Copyright (c) 2012-2014 Red Hat, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -18,6 +18,11 @@ # Simply importing this monkey patches the constraint handling to fit our # needs import gluster.swift.common.constraints # noqa +from swift.common.swob import HTTPConflict +from swift.common.utils import public, timing_stats +from gluster.swift.common.exceptions import AlreadyExistsAsFile, \ + AlreadyExistsAsDir +from swift.common.request_helpers import split_and_validate_path from swift.obj import server @@ -80,6 +85,16 @@ class ObjectController(server.ObjectController): """ return + @public + @timing_stats() + def PUT(self, request): + try: + return server.ObjectController.PUT(self, request) + except (AlreadyExistsAsFile, AlreadyExistsAsDir): + device = \ + split_and_validate_path(request, 1, 5, True) + return HTTPConflict(drive=device, request=request) + def app_factory(global_conf, **local_conf): """paste.deploy app factory for creating WSGI object server apps""" |