Superbalist / thumbor-cloud-storage

Thumbor Loader and Result Storage for Google Cloud Storage
https://pypi.org/project/thumbor-cloud-storage
MIT License
17 stars 12 forks source link

blob.updated returns timezone aware data. #3

Closed eceglov closed 8 years ago

eceglov commented 8 years ago

It looks like the data format returned by blob.updated has changed. Made datetime.now() timezone aware.

Error example:

2016-04-07 07:57:12 thumbor:ERROR [RESULT_STORAGE] getting from thumbor/v2/un/sa/unsafe/100x0/TuxOSX.png 2016-04-07 07:57:12 tornado.application:ERROR Future exception was never retrieved: Traceback (most recent call last): File "/usr/lib64/python2.7/site-packages/tornado/gen.py", line 282, in wrapper yielded = next(result) File "/usr/lib64/python2.7/site-packages/thumbor/handlers/init.py", line 63, in execute_image_operations result = yield gen.maybe_future(self.context.modules.result_storage.get()) File "/usr/lib64/python2.7/site-packages/thumbor/result_storages/cloud_storage.py", line 76, in get if not blob or self.is_expired(blob): File "/usr/lib64/python2.7/site-packages/thumbor/result_storages/cloud_storage.py", line 101, in is_expired timediff = datetime.now() - blob.updated TypeError: can't subtract offset-naive and offset-aware datetimes Thank you.