Exemplo n.º 1
0
    def revisions(self, path, **kwargs):
        """Get past versions of the requested key

        :param str path: The path to a key
        :rtype list:
        """
        url = self.bucket.generate_url(settings.TEMP_URL_SECS, 'GET', query_parameters={'versions': ''})
        resp = yield from self.make_request(
            'GET',
            url,
            params={'prefix': path.path, 'delimiter': '/'},
            expects=(200, ),
            throws=exceptions.MetadataError,
        )
        content = yield from resp.read_and_close()
        versions = xmltodict.parse(content)['ListVersionsResult'].get('Version') or []

        if isinstance(versions, dict):
            versions = [versions]

        return [
            S3Revision(item)
            for item in versions
            if item['Key'] == path.path
        ]
Exemplo n.º 2
0
    async def revisions(self, path, **kwargs):
        """Get past versions of the requested key

        :param str path: The path to a key
        :rtype list:
        """
        await self._check_region()

        query_params = {'prefix': path.path, 'delimiter': '/', 'versions': ''}
        url = functools.partial(self.bucket.generate_url,
                                settings.TEMP_URL_SECS,
                                'GET',
                                query_parameters=query_params)
        resp = await self.make_request(
            'GET',
            url,
            params=query_params,
            expects=(200, ),
            throws=exceptions.MetadataError,
        )
        content = await resp.read()
        versions = xmltodict.parse(content)['ListVersionsResult'].get(
            'Version') or []

        if isinstance(versions, dict):
            versions = [versions]

        return [
            S3Revision(item) for item in versions if item['Key'] == path.path
        ]
Exemplo n.º 3
0
def revision_metadata_object():
    content = OrderedDict(
        Key='single-version.file',
        VersionId='3/L4kqtJl40Nr8X8gdRQBpUMLUo',
        IsLatest='true',
        LastModified='2009-10-12T17:50:30.000Z',
        ETag='"fba9dede5f27731c9771645a39863328"',
        Size=434234,
        StorageClass='STANDARD',
        Owner=OrderedDict(
            ID=
            '75aa57f09aa0c8caeab4f8c24e99d10f8e7faeebf76c078efc7c6caea54ba06a',
            DisplayName='*****@*****.**'))

    return S3Revision(content)