pypicloud.storage.files module

Store packages as files on disk

class pypicloud.storage.files.FileStorage(request=None, **kwargs)[source]

Bases: IStorage

Stores package files on the filesystem

classmethod configure(settings)[source]

Configure the storage method with app settings

delete(package)[source]

Delete a package file

Parameters
packagePackage

The package metadata

download_response(package)[source]

Return a HTTP Response that will download this package

This is called from the download endpoint

get_metadata_path(package)[source]

Get the fully-qualified file path for a package metadata file

get_path(package)[source]

Get the fully-qualified file path for a package

list(factory=<class 'pypicloud.models.Package'>)[source]

Return a list or generator of all packages

open(package)[source]

Get a buffer object that can read the package data

This should be a context manager. It is used in migration scripts, not directly by the web application.

Parameters
packagePackage

Examples

with storage.open(package) as pkg_data:
    with open('outfile.tar.gz', 'w') as ofile:
        ofile.write(pkg_data.read())
path_to_meta_path(path)[source]

Construct the filename for a metadata file

upload(package, datastream)[source]

Upload a package file to the storage backend

Parameters
packagePackage

The package metadata

datastreamfile

A file-like object that contains the package data