prefix_file_utcnow.py 274 B

12345678
  1. from datetime import datetime
  2. from os import path
  3. from werkzeug import secure_filename
  4. def prefix_file_utcnow(model, file_data):
  5. parts = path.splitext(file_data.filename)
  6. return secure_filename('%s%s' % (datetime.utcnow().strftime('%Y-%m-%d-%H-%M-%S'), parts[1]))