예제 #1
0
파일: store.py 프로젝트: jjl/warehouse
def distribution_file(dist, dist_file):
    app = flask.current_app

    # Generate all the hashes for this file
    hashes = {}
    for algorithm in hashlib.algorithms:
        hashes[algorithm] = getattr(hashlib, algorithm)(dist_file).hexdigest()

    # Save our file
    storage = get_storage(app=app)
    filename = storage.save(dist.filename, io.BytesIO(dist_file))

    # Store our information on the model
    dist.hashes = hashes
    dist.file = filename
예제 #2
0
def distribution_file(dist, dist_file):
    app = flask.current_app

    # Generate all the hashes for this file
    hashes = {}
    for algorithm in hashlib.algorithms:
        hashes[algorithm] = getattr(hashlib, algorithm)(dist_file).hexdigest()

    # Save our file
    storage = get_storage(app=app)
    filename = storage.save(dist.filename, io.BytesIO(dist_file))

    # Store our information on the model
    dist.hashes = hashes
    dist.file = filename
예제 #3
0
 def uri(self):
     storage = get_storage()
     return storage.url(self.file)
예제 #4
0
 def uri(self):
     storage = get_storage()
     return storage.url(self.file)