Storages API modified_time() and timezones.

65 views
Skip to first unread message

Ian Lewis

unread,
Oct 19, 2013, 12:43:23 AM10/19/13
to django...@googlegroups.com
Hi,

I'm trying to get a handle on the modified_time() method in the Storages API. I couldn't find any hints in the doc as to what the right way to implement the modified_time() method was in regard to timezones. Currently it looks like the default FileSystemStorage backend returns the modified time as returned from os.path.getmtime() which is in the system timezone. 

Should the modified time as returned by modified_time() be in the system timezone (this is not the TIME_ZONE setting)? i.e. the FileSystemStorage is the de-facto standard?

The reason I ask this is because it raises an issue when using other different backends together since the collectstatic command will compare modified times of files from the different backends to determine if it needs to update the file. We have problems with this because some systems like AWS's S3 will return the modified time in UTC or some other timezone and need to be converted.

--
Ian

http://www.ianlewis.org/
Reply all
Reply to author
Forward
0 new messages