Пример #1
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
Пример #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)