• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python base.get_object_info函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中swift.proxy.controllers.base.get_object_info函数的典型用法代码示例。如果您正苦于以下问题:Python get_object_info函数的具体用法?Python get_object_info怎么用?Python get_object_info使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了get_object_info函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test_get_object_info_swift_source

 def test_get_object_info_swift_source(self):
     app = FakeApp()
     req = Request.blank("/v1/a/c/o",
                         environ={'swift.cache': FakeCache()})
     get_object_info(req.environ, app, swift_source='LU')
     self.assertEqual([e['swift.source'] for e in app.captured_envs],
                      ['LU'])
开发者ID:mahak,项目名称:swift,代码行数:7,代码来源:test_base.py


示例2: __call__

    def __call__(self, env, start_response):
        """
        If called with header X-Pid-Create and Method PUT become active and
        create a PID and store it with the object
        :param env: request environment
        :param start_response: function that we call when creating response
        :return:
        """
        self.start_response = start_response
        request = Request(env)
        if request.method == 'PUT':
            if 'X-Pid-Create' in list(request.headers.keys()):
                url = '{}{}'.format(request.host_url, request.path_info)
                if 'X-Pid-Parent' in list(request.headers.keys()):
                    parent = request.headers['X-Pid-Parent']
                else:
                    parent = None
                success, pid = create_pid(object_url=url,
                                          api_url=self.conf.get('api_url'),
                                          username=self.conf.get('username'),
                                          password=self.conf.get('password'),
                                          parent=parent)
                if success:
                    self.logger.info('Created a PID for {}'.format(url))
                    request.headers['X-Object-Meta-PID'] = pid
                    response = PersistentIdentifierResponse(
                        pid=pid,
                        add_checksum=self.add_checksum,
                        username=self.conf.get('username'),
                        password=self.conf.get('password'),
                        start_response=start_response,
                        logger=self.logger)
                    return self.app(env, response.finish_response)
                else:
                    self.logger.error('Unable to create  a PID for {},'
                                      'because of {}'.format(url, pid))
                    return Response(
                        status=502,
                        body='Could not contact PID API')(env, start_response)
        elif request.method in ['GET', 'HEAD']:
            # only modify response if we have a request for a object
            try:
                split_path(request.path_info, 4, 4, True)
            except ValueError:
                return self.app(env, start_response)

            object_metadata = get_object_info(
                env=request.environ,
                app=self.app,
                swift_source='PersistentIdentifierMiddleware')['meta']
            if 'pid' in object_metadata.keys():
                response = PersistentIdentifierResponse(
                    pid='',
                    add_checksum='',
                    username='',
                    password='',
                    start_response=start_response,
                    logger=self.logger)
                return self.app(env, response.finish_response_pidurl)
        return self.app(env, start_response)
开发者ID:BeneDicere,项目名称:swift-persistent-identifier,代码行数:60,代码来源:persistent_identifier_middleware.py


示例3: object_request

 def object_request(self, req, api_version, account, container, obj,
                    allow_versioned_writes):
     container_name = unquote(container)
     object_name = unquote(obj)
     orig_container = get_unversioned_container(container_name)
     if orig_container != container_name:
         orig_object, version = \
             swift3_split_object_name_version(object_name)
         req.environ['oio.query'] = {'version': version}
         req.environ['PATH_INFO'] = '/%s/%s/%s/%s' % (api_version,
                                                      account,
                                                      quote(orig_container),
                                                      quote(orig_object))
     elif req.method == 'DELETE':
         ver_mode = req.headers.get('X-Backend-Versioning-Mode-Override',
                                    'history')
         if ver_mode == 'stack':
             # Do not create a delete marker, delete the latest version
             obj_inf = get_object_info(req.environ, self.app,
                                       swift_source='VW')
             req.environ['oio.query'] = {
                 'version': obj_inf.get('sysmeta', {}).get('version-id')
             }
     resp = req.get_response(self.app)
     if req.method == 'HEAD':
         close_if_possible(resp.app_iter)
     return resp
开发者ID:jfsmig,项目名称:oio-swift,代码行数:27,代码来源:versioned_writes.py


示例4: test_get_object_info_env

 def test_get_object_info_env(self):
     cached = {"status": 200, "length": 3333, "type": "application/json", "meta": {}}
     env_key = get_object_env_key("account", "cont", "obj")
     req = Request.blank("/v1/account/cont/obj", environ={env_key: cached, "swift.cache": FakeCache({})})
     resp = get_object_info(req.environ, "xxx")
     self.assertEquals(resp["length"], 3333)
     self.assertEquals(resp["type"], "application/json")
开发者ID:helen5haha,项目名称:swift,代码行数:7,代码来源:test_base.py


示例5: PUT

    def PUT(self, req):
        """HTTP PUT request handler."""
        container_info = self.container_info(
            self.account_name, self.container_name, req)

        req.acl = container_info['write_acl']
        req.environ['swift_sync_key'] = container_info['sync_key']

        # is request authorized
        if 'swift.authorize' in req.environ:
            aresp = req.environ['swift.authorize'](req)
            if aresp:
                return aresp

        old_slo_manifest = None
        # If versioning is disabled, we must check if the object exists.
        # If it's a SLO, we will have to delete the parts if the current
        # operation is a success.
        if (self.app.delete_slo_parts and
                not container_info['sysmeta'].get('versions-location', None)):
            try:
                dest_info = get_object_info(req.environ, self.app)
                if 'slo-size' in dest_info['sysmeta']:
                    manifest_env = req.environ.copy()
                    manifest_env['QUERY_STRING'] = 'multipart-manifest=get'
                    manifest_req = make_subrequest(manifest_env, 'GET')
                    manifest_resp = manifest_req.get_response(self.app)
                    old_slo_manifest = json.loads(manifest_resp.body)
            except Exception as exc:
                self.app.logger.warn(('Failed to check existence of %s. If '
                                      'overwriting a SLO, old parts may '
                                      'remain. Error was: %s') %
                                     (req.path, exc))

        self._update_content_type(req)

        self._update_x_timestamp(req)

        # check constraints on object name and request headers
        error_response = check_object_creation(req, self.object_name) or \
            check_content_type(req)
        if error_response:
            return error_response

        if req.headers.get('Oio-Copy-From'):
            return self._link_object(req)

        data_source = req.environ['wsgi.input']
        if req.content_length:
            data_source = ExpectedSizeReader(data_source, req.content_length)

        headers = self._prepare_headers(req)
        with closing_if_possible(data_source):
            resp = self._store_object(req, data_source, headers)
        if old_slo_manifest and resp.is_success:
            self.app.logger.debug(
                'Previous object %s was a SLO, deleting parts',
                req.path)
            self._delete_slo_parts(req, old_slo_manifest)
        return resp
开发者ID:fvennetier,项目名称:oio-swift,代码行数:60,代码来源:obj.py


示例6: test_get_object_info_swift_source

 def test_get_object_info_swift_source(self):
     req = Request.blank("/v1/a/c/o",
                         environ={'swift.cache': FakeCache({})})
     with patch('swift.proxy.controllers.base.'
                '_prepare_pre_auth_info_request', FakeRequest):
         resp = get_object_info(req.environ, 'app', swift_source='LU')
     self.assertEquals(resp['meta']['fakerequest-swift-source'], 'LU')
开发者ID:10389030,项目名称:swift,代码行数:7,代码来源:test_base.py


示例7: test_get_object_info_no_env

 def test_get_object_info_no_env(self):
     req = Request.blank("/v1/account/cont/obj",
                         environ={'swift.cache': FakeCache({})})
     with patch('swift.proxy.controllers.base.'
                '_prepare_pre_auth_info_request', FakeRequest):
         resp = get_object_info(req.environ, 'xxx')
     self.assertEquals(resp['length'], 5555)
     self.assertEquals(resp['type'], 'text/plain')
开发者ID:10389030,项目名称:swift,代码行数:8,代码来源:test_base.py


示例8: test_get_object_info_no_env

 def test_get_object_info_no_env(self):
     app = FakeApp()
     req = Request.blank("/v1/account/cont/obj", environ={"swift.cache": FakeCache({})})
     resp = get_object_info(req.environ, app)
     self.assertEqual(app.responses.stats["account"], 0)
     self.assertEqual(app.responses.stats["container"], 0)
     self.assertEqual(app.responses.stats["obj"], 1)
     self.assertEquals(resp["length"], 5555)
     self.assertEquals(resp["type"], "text/plain")
开发者ID:helen5haha,项目名称:swift,代码行数:9,代码来源:test_base.py


示例9: __call__

    def __call__(self, request):

        if request.method not in ("POST", "PUT"):
            return self.app

        try:
            ver, account, container, obj = request.split_path(2, 4, rest_with_last=True)
        except ValueError:
            return self.app

        if not container:
            # account request, so we pay attention to the quotas
            new_quota = request.headers.get("X-Account-Meta-Quota-Bytes")
            remove_quota = request.headers.get("X-Remove-Account-Meta-Quota-Bytes")
        else:
            # container or object request; even if the quota headers are set
            # in the request, they're meaningless
            new_quota = remove_quota = None

        if remove_quota:
            new_quota = 0  # X-Remove dominates if both are present

        if request.environ.get("reseller_request") is True:
            if new_quota and not new_quota.isdigit():
                return HTTPBadRequest()
            return self.app

        # deny quota set for non-reseller
        if new_quota is not None:
            return HTTPForbidden()

        if obj and request.method == "POST" or not obj:
            return self.app

        copy_from = request.headers.get("X-Copy-From")
        content_length = request.content_length or 0

        if obj and copy_from:
            path = "/" + ver + "/" + account + "/" + copy_from.lstrip("/")
            object_info = get_object_info(request.environ, self.app, path)
            if not object_info or not object_info["length"]:
                content_length = 0
            else:
                content_length = int(object_info["length"])

        account_info = get_account_info(request.environ, self.app)
        if not account_info or not account_info["bytes"]:
            return self.app

        new_size = int(account_info["bytes"]) + content_length
        quota = int(account_info["meta"].get("quota-bytes", -1))

        if 0 <= quota < new_size:
            return HTTPRequestEntityTooLarge()

        return self.app
开发者ID:JioCloud,项目名称:swift,代码行数:56,代码来源:account_quotas.py


示例10: test_get_object_info_no_env

 def test_get_object_info_no_env(self):
     app = FakeApp()
     req = Request.blank("/v1/account/cont/obj",
                         environ={'swift.cache': FakeCache({})})
     resp = get_object_info(req.environ, app)
     self.assertEqual(app.responses.stats['account'], 0)
     self.assertEqual(app.responses.stats['container'], 0)
     self.assertEqual(app.responses.stats['obj'], 1)
     self.assertEqual(resp['length'], 5555)
     self.assertEqual(resp['type'], 'text/plain')
开发者ID:mahak,项目名称:swift,代码行数:10,代码来源:test_base.py


示例11: test_get_object_info_env

 def test_get_object_info_env(self):
     cached = {'status': 200,
               'length': 3333,
               'type': 'application/json',
               'meta': {}}
     env_key = get_object_env_key("account", "cont", "obj")
     req = Request.blank("/v1/account/cont/obj",
                         environ={env_key: cached,
                                  'swift.cache': FakeCache({})})
     resp = get_object_info(req.environ, 'xxx')
     self.assertEquals(resp['length'], 3333)
     self.assertEquals(resp['type'], 'application/json')
开发者ID:10389030,项目名称:swift,代码行数:12,代码来源:test_base.py


示例12: apply_storage_quota

    def apply_storage_quota(self, req, service_plan, account_info,
                            ver, account, container, obj):
        if not obj:
            quota = service_plan['containers']
            # If "number of containers" = (quota + 1): deny PUT
            # We don't want to deny overwrite of the last container
            new_size = int(account_info['container_count'])
            if 0 <= quota < new_size:
                return bad_response(
                    req, None, 'Over quota: containers')
            return None

        content_length = (req.content_length or 0)
        if req.method == 'COPY':
            copy_from = container + '/' + obj
        else:
            copy_from = req.headers.get('X-Copy-From')
        container_info = None
        if copy_from:
            copy_account = req.headers.get('X-Copy-From-Account', account)
            path = '/' + ver + '/' + copy_account + '/' + copy_from.lstrip('/')
            # We are copying from another account
            # Let's not leak the existence of the remote object
            # to the unauthorized user
            if copy_account != account:
                container_info = get_container_info(req.environ, self.app,
                                                    swift_source='litequota')
                aresp = check_acl(req, container_info, 'read_acl')
                if aresp:
                    return aresp
            object_info = get_object_info(req.environ, self.app, path)
            if not object_info or not object_info['length']:
                content_length = 0
            else:
                content_length = int(object_info['length'])
        new_size = int(account_info['bytes']) + content_length
        quota = service_plan['bytes']
        if 0 <= quota < new_size:
            if not container_info:
                container_info = get_container_info(req.environ, self.app,
                                                    swift_source='litequota')
            return bad_response(req, container_info, 'Over quota: bytes')
        # If "number of objects" == (quota + 1): deny PUT
        # We don't want to deny overwrite of the last object
        new_size = int(account_info['total_object_count'])
        quota = service_plan['objects']
        if 0 <= quota < new_size:
            if not container_info:
                container_info = get_container_info(req.environ, self.app,
                                                    swift_source='litequota')
            return bad_response(req, container_info, 'Over quota: objects')
开发者ID:pkit,项目名称:liteauth,代码行数:51,代码来源:litequota.py


示例13: __call__

    def __call__(self, req):
        try:
            (version, account, container, obj) = req.split_path(3, 4, True)
        except ValueError:
            return self.app

        # verify new quota headers are properly formatted
        if not obj and req.method in ("PUT", "POST"):
            val = req.headers.get("X-Container-Meta-Quota-Bytes")
            if val and not val.isdigit():
                return HTTPBadRequest(body="Invalid bytes quota.")
            val = req.headers.get("X-Container-Meta-Quota-Count")
            if val and not val.isdigit():
                return HTTPBadRequest(body="Invalid count quota.")

        # check user uploads against quotas
        elif obj and req.method == "PUT":
            container_info = get_container_info(req.environ, self.app, swift_source="CQ")
            if not container_info or not is_success(container_info["status"]):
                # this will hopefully 404 later
                return self.app

            if (
                "quota-bytes" in container_info.get("meta", {})
                and "bytes" in container_info
                and container_info["meta"]["quota-bytes"].isdigit()
            ):
                content_length = req.content_length or 0
                copy_from = req.headers.get("X-Copy-From")
                if copy_from:
                    path = "/%s/%s/%s" % (version, account, copy_from.lstrip("/"))
                    object_info = get_object_info(req.environ, self.app, path)
                    if not object_info or not object_info["length"]:
                        content_length = 0
                    else:
                        content_length = int(object_info["length"])
                new_size = int(container_info["bytes"]) + content_length
                if int(container_info["meta"]["quota-bytes"]) < new_size:
                    return self.bad_response(req, container_info)

            if (
                "quota-count" in container_info.get("meta", {})
                and "object_count" in container_info
                and container_info["meta"]["quota-count"].isdigit()
            ):
                new_count = int(container_info["object_count"]) + 1
                if int(container_info["meta"]["quota-count"]) < new_count:
                    return self.bad_response(req, container_info)

        return self.app
开发者ID:jettang,项目名称:icehouse,代码行数:50,代码来源:container_quotas.py


示例14: __call__

    def __call__(self, req):
        try:
            (version, account, container, obj) = req.split_path(3, 4, True)
        except ValueError:
            return self.app

        # verify new quota headers are properly formatted
        if not obj and req.method in ('PUT', 'POST'):
            val = req.headers.get('X-Container-Meta-Quota-Bytes')
            if val and not val.isdigit():
                return HTTPBadRequest(body='Invalid bytes quota.')
            val = req.headers.get('X-Container-Meta-Quota-Count')
            if val and not val.isdigit():
                return HTTPBadRequest(body='Invalid count quota.')

        # check user uploads against quotas
        elif obj and req.method == 'PUT':
            container_info = get_container_info(
                req.environ, self.app, swift_source='CQ')
            if not container_info or not is_success(container_info['status']):
                # this will hopefully 404 later
                return self.app

            if 'quota-bytes' in container_info.get('meta', {}) and \
                    'bytes' in container_info and \
                    container_info['meta']['quota-bytes'].isdigit():
                content_length = (req.content_length or 0)
                if 'x-copy-from' in req.headers:
                    src_cont, src_obj = check_copy_from_header(req)
                    path = '/%s/%s/%s/%s' % (version, account,
                                             src_cont, src_obj)
                    object_info = get_object_info(req.environ, self.app, path)
                    if not object_info or not object_info['length']:
                        content_length = 0
                    else:
                        content_length = int(object_info['length'])
                new_size = int(container_info['bytes']) + content_length
                if int(container_info['meta']['quota-bytes']) < new_size:
                    return self.bad_response(req, container_info)

            if 'quota-count' in container_info.get('meta', {}) and \
                    'object_count' in container_info and \
                    container_info['meta']['quota-count'].isdigit():
                new_count = int(container_info['object_count']) + 1
                if int(container_info['meta']['quota-count']) < new_count:
                    return self.bad_response(req, container_info)

        return self.app
开发者ID:KnightKu,项目名称:swift,代码行数:48,代码来源:container_quotas.py


示例15: __call__

    def __call__(self, request):

        if request.method not in ("POST", "PUT"):
            return self.app

        try:
            ver, acc, cont, obj = request.split_path(2, 4, rest_with_last=True)
        except ValueError:
            return self.app

        new_quota = request.headers.get('X-Account-Meta-Quota-Bytes')
        remove_quota = request.headers.get('X-Remove-Account-Meta-Quota-Bytes')
        if remove_quota:
            new_quota = 0    # X-Remove dominates if both are present

        if request.environ.get('reseller_request') is True:
            if new_quota and not new_quota.isdigit():
                return HTTPBadRequest()
            return self.app

        # deny quota set for non-reseller
        if new_quota is not None:
            return HTTPForbidden()

        copy_from = request.headers.get('X-Copy-From')
        content_length = (request.content_length or 0)

        if obj and copy_from:
            path = '/' + ver + '/' + acc + '/' + copy_from.lstrip('/')
            object_info = get_object_info(request.environ, self.app, path)
            if not object_info or not object_info['length']:
                content_length = 0
            else:
                content_length = int(object_info['length'])

        account_info = get_account_info(request.environ, self.app)
        if not account_info or not account_info['bytes']:
            return self.app

        new_size = int(account_info['bytes']) + content_length
        quota = int(account_info['meta'].get('quota-bytes', -1))

        if 0 <= quota < new_size:
            return HTTPRequestEntityTooLarge()

        return self.app
开发者ID:Dieterbe,项目名称:swift,代码行数:46,代码来源:account_quotas.py


示例16: subtract_quota_used

 def subtract_quota_used(self, quota_info, env):
     # HEAD to swift resource to know the content length
     quota_limit = long(quota_info['quota_limit'])
     quota_used = long(quota_info['quota_used'])
     
     object_info = get_object_info(env, self.app, env['PATH_INFO'])
     if not object_info or not object_info['length']:
         content_to_delete = 0
     else:
         content_to_delete = long(object_info['length'])
     
     quota_used_after_delete = quota_used - content_to_delete
     
     #send new quota to quota server
     self.app.logger.info('StackSync Quota: subtract_quota_used')
     response = self.rpc_server.XmlRpcQuotaHandler.updateAvailableQuota(quota_info['user'], str(quota_used_after_delete))
     
     response = create_response(response, status_code=200)
         
     if not is_valid_status(response.status_int):
         self.app.logger.error("StackSync Quota: Error updating quota used")
         return response
     
     return self.app
开发者ID:carriercomm,项目名称:swift-stacksync-quota,代码行数:24,代码来源:stacksync_quota.py


示例17: __call__

    def __call__(self, request):
        try:
            (version, account, container, objname) = split_path(
                request.path_info, 1, 4, True)
        except ValueError:
            return self.app

        if container and self.header_container_metadata:
            container_info = get_container_info(request.environ, self.app)
            for key in self.header_container_metadata:
                value = container_info.get('meta', {}).get(key)
                if value:
                    keyname = 'X-CONTAINER-METADATA-%s' % key.upper() 
                    request.headers[keyname] = value

        if objname and self.header_object_metadata:
            object_info = get_object_info(request.environ, self.app)
            for key in self.header_object_metadata:
                value = object_info.get('meta', {}).get(key)
                if value:
                    keyname = 'X-OBJECT-METADATA-%s' % key 
                    request.headers[keyname] = value

        return self.app
开发者ID:cschwede,项目名称:swift-metadataheaders,代码行数:24,代码来源:middleware.py


示例18: __call__

    def __call__(self, request):

        if request.method not in ("POST", "PUT", "COPY"):
            return self.app

        try:
            ver, account, container, obj = request.split_path(
                2, 4, rest_with_last=True)
        except ValueError:
            return self.app

        if not container:
            # account request, so we pay attention to the quotas
            new_quota = request.headers.get(
                'X-Account-Meta-Quota-Bytes')
            remove_quota = request.headers.get(
                'X-Remove-Account-Meta-Quota-Bytes')
        else:
            # container or object request; even if the quota headers are set
            # in the request, they're meaningless
            new_quota = remove_quota = None

        if remove_quota:
            new_quota = 0    # X-Remove dominates if both are present

        if request.environ.get('reseller_request') is True:
            if new_quota and not new_quota.isdigit():
                return HTTPBadRequest()
            return self.app

        # deny quota set for non-reseller
        if new_quota is not None:
            return HTTPForbidden()

        if obj and request.method == "POST" or not obj:
            return self.app

        if request.method == 'COPY':
            copy_from = container + '/' + obj
        else:
            copy_from = request.headers.get('X-Copy-From')

        content_length = (request.content_length or 0)

        account_info = get_account_info(request.environ, self.app)
        if not account_info or not account_info['bytes']:
            return self.app
        try:
            quota = int(account_info['meta'].get('quota-bytes', -1))
        except ValueError:
            return self.app
        if quota < 0:
            return self.app

        if obj and copy_from:
            path = '/' + ver + '/' + account + '/' + copy_from.lstrip('/')
            object_info = get_object_info(request.environ, self.app, path)
            if not object_info or not object_info['length']:
                content_length = 0
            else:
                content_length = int(object_info['length'])

        new_size = int(account_info['bytes']) + content_length
        if quota < new_size:
            return HTTPRequestEntityTooLarge()

        return self.app
开发者ID:eric200xx,项目名称:swift,代码行数:67,代码来源:account_quotas.py


示例19: __call__

    def __call__(self, request):

        if request.method not in ("POST", "PUT", "COPY"):
            return self.app

        try:
            ver, account, container, obj = request.split_path(
                2, 4, rest_with_last=True)
        except ValueError:
            return self.app

        if not container:
            # account request, so we pay attention to the quotas
            new_quota = request.headers.get(
                'X-Account-Meta-Quota-Bytes')
            remove_quota = request.headers.get(
                'X-Remove-Account-Meta-Quota-Bytes')
        else:
            # container or object request; even if the quota headers are set
            # in the request, they're meaningless
            new_quota = remove_quota = None

        if remove_quota:
            new_quota = 0    # X-Remove dominates if both are present

        if request.environ.get('reseller_request') is True:
            if new_quota and not new_quota.isdigit():
                return HTTPBadRequest()
            return self.app

        # deny quota set for non-reseller
        if new_quota is not None:
            return HTTPForbidden()

        if request.method == "POST" or not obj:
            return self.app

        if request.method == 'COPY':
            copy_from = container + '/' + obj
        else:
            if 'x-copy-from' in request.headers:
                src_cont, src_obj = check_copy_from_header(request)
                copy_from = "%s/%s" % (src_cont, src_obj)
            else:
                copy_from = None

        content_length = (request.content_length or 0)

        account_info = get_account_info(request.environ, self.app)
        if not account_info or not account_info['bytes']:
            return self.app
        try:
            quota = int(account_info['meta'].get('quota-bytes', -1))
        except ValueError:
            return self.app
        if quota < 0:
            return self.app

        if copy_from:
            path = '/' + ver + '/' + account + '/' + copy_from
            object_info = get_object_info(request.environ, self.app, path)
            if not object_info or not object_info['length']:
                content_length = 0
            else:
                content_length = int(object_info['length'])

        new_size = int(account_info['bytes']) + content_length
        if quota < new_size:
            resp = HTTPRequestEntityTooLarge(body='Upload exceeds quota.')
            if 'swift.authorize' in request.environ:
                orig_authorize = request.environ['swift.authorize']

                def reject_authorize(*args, **kwargs):
                    aresp = orig_authorize(*args, **kwargs)
                    if aresp:
                        return aresp
                    return resp
                request.environ['swift.authorize'] = reject_authorize
            else:
                return resp

        return self.app
开发者ID:2015-ucsc-hp,项目名称:swift,代码行数:82,代码来源:account_quotas.py


示例20: test_get_object_info_swift_source

 def test_get_object_info_swift_source(self):
     app = FakeApp()
     req = Request.blank("/v1/a/c/o", environ={"swift.cache": FakeCache()})
     get_object_info(req.environ, app, swift_source="LU")
     self.assertEqual(app.sources, ["LU"])
开发者ID:helen5haha,项目名称:swift,代码行数:5,代码来源:test_base.py



注:本文中的swift.proxy.controllers.base.get_object_info函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python base.headers_to_account_info函数代码示例发布时间:2022-05-27
下一篇:
Python base.get_container_memcache_key函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap