Bläddra i källkod

check to see if a file has changed before uploading it..

main
John-Mark Gurney 7 år sedan
förälder
incheckning
e41987b9a2
1 ändrade filer med 5 tillägg och 1 borttagningar
  1. +5
    -1
      publishers/s3.py

+ 5
- 1
publishers/s3.py Visa fil

@@ -45,6 +45,10 @@ class S3(Publisher):
if redirect['from'] in item.path:
redirect_meta = redirect['to']
k.key = item.path.replace(str(root), '')
k.set_contents_from_filename(item.path)
kmd5 = bucket.get_key(item.path.replace(str(root), '')).etag[1:-1]
#print 'f:', `kmd5, k.compute_md5(open(item.path))[0]`
if kmd5 != k.compute_md5(open(item.path))[0]:
print 'updating:', `item.path.replace(str(root), '')`
k.set_contents_from_filename(item.path)
if redirect_meta:
k.set_metadata('website-redirect-location', redirect_meta)

Laddar…
Avbryt
Spara