Example #1
0
    def test_meta_get(self):
        OBJECT_NAME = 'objectName'
        headers = {'x-object-meta-hoge': 'fuga'}
        self.mox.StubOutWithMock(api, 'swift_get_object_info')
        api.swift_get_object_info(IsA(http.HttpRequest),
                                  unicode(self.CONTAINER_NAME),
                                  OBJECT_NAME).AndReturn(headers)
        self.mox.ReplayAll()

        res = self.client.get(reverse('dash_objects_meta',
                                      args=[self.TEST_TENANT,
                                            self.CONTAINER_NAME,
                                            OBJECT_NAME]))

        self.mox.VerifyAll()
Example #2
0
def meta(request, tenant_id, container_name, object_name):

    form, handled = ObjectMeta.maybe_handle(request)
    if handled:
        return handled

    remove_form, handled = ObjectMetaRemove.maybe_handle(request)
    if handled:
        return handled

    metadata = api.swift_get_object_info(request, container_name, object_name)

    headers = []
    if metadata:
        for h, v in metadata.iteritems():
            headers.append(('%s-%s' % ('x-object-meta',h) ,v))
    return render_to_response(
        'django_openstack/dash/objects/meta.html',
        {'container_name': container_name,
         'object_name': object_name,
         'metadata' : headers,
         'meta_form' : form,
         'remove_form' : remove_form
        },
        context_instance=template.RequestContext(request))
Example #3
0
def meta(request, tenant_id, container_name, object_name):

    form, handled = ObjectMeta.maybe_handle(request)
    if handled:
        return handled

    remove_form, handled = ObjectMetaRemove.maybe_handle(request)
    if handled:
        return handled

    metadata = api.swift_get_object_info(request, container_name, object_name)

    headers = []
    if metadata:
        for h, v in metadata.iteritems():
            headers.append(('%s-%s' % ('x-object-meta', h), v))
    return render_to_response(
        'django_openstack/dash/objects/meta.html', {
            'container_name': container_name,
            'object_name': object_name,
            'metadata': headers,
            'meta_form': form,
            'remove_form': remove_form
        },
        context_instance=template.RequestContext(request))
Example #4
0
def meta(request, tenant_id, container_name, object_name):

    form, handled = ObjectMeta.maybe_handle(request)
    if handled:
        return handled

    remove_form, handled = ObjectMetaRemove.maybe_handle(request)
    if handled:
        return handled


    container_name_unquoted = unquote(container_name)
    object_name_unquoted = unquote(object_name)

    try:
        metadata = api.swift_get_object_info(request, container_name, object_name,
                                             request.session.get('storage_url', None))
        headers = []
        if metadata:
            for h, v in metadata.iteritems():
                headers.append(('%s-%s' % ('x-object-meta',h) ,v))
    except ResponseError, e:
        messages.error('Retrieving Metadata from %s is failed: %s' % (container_name_unquoted, str(e)))
Example #5
0
def meta(request, tenant_id, container_name, object_name):

    form, handled = ObjectMeta.maybe_handle(request)
    if handled:
        return handled

    remove_form, handled = ObjectMetaRemove.maybe_handle(request)
    if handled:
        return handled

    container_name_unquoted = unquote(container_name)
    object_name_unquoted = unquote(object_name)

    try:
        metadata = api.swift_get_object_info(
            request, container_name, object_name,
            request.session.get('storage_url', None))
        headers = []
        if metadata:
            for h, v in metadata.iteritems():
                headers.append(('%s-%s' % ('x-object-meta', h), v))
    except ResponseError, e:
        messages.error('Retrieving Metadata from %s is failed: %s' %
                       (container_name_unquoted, str(e)))