Commits

Kurtis Nusbaum  committed 0130f8e

Fixed the s3 and s3boto storages so the modified_file function doesn't depend on the dateutil package. Have not tested this yet.

  • Participants
  • Parent commits 3a53e65

Comments (0)

Files changed (2)

File storages/backends/s3.py

             response = self.connection._make_request('HEAD', self.bucket, name)
             last_modified = response.getheader('Last-Modified')
         # convert to string to date
-        last_modified_date = parser.parse(last_modified)
-        # if the date has no timzone, assume UTC
-        if last_modified_date.tzinfo == None:
-            last_modified_date = last_modified_date.replace(tzinfo=tz.tzutc())
-        # convert date to local time w/o timezone
-        return last_modified_date.astimezone(tz.tzlocal()).replace(tzinfo=None)
+        return datetime.fromtimestamp(entry.last_modified)
 
     ## UNCOMMENT BELOW IF NECESSARY
     #def get_available_name(self, name):

File storages/backends/s3boto.py

         return self.bucket.get_key(self._encode_name(name)).size
 
     def modified_time(self, name):
-        try:
-            from dateutil import parser, tz
-        except ImportError:
-            raise NotImplementedError()
+        from datetime import parser
         name = self._normalize_name(self._clean_name(name))
         entry = self.entries.get(name)
         # only call self.bucket.get_key() if the key is not found
         if entry is None:
             entry = self.bucket.get_key(self._encode_name(name))
         # convert to string to date
-        last_modified_date = parser.parse(entry.last_modified)
-        # if the date has no timzone, assume UTC
-        if last_modified_date.tzinfo == None:
-            last_modified_date = last_modified_date.replace(tzinfo=tz.tzutc())
-        # convert date to local time w/o timezone
-        timezone = tz.gettz(settings.TIME_ZONE)
-        return last_modified_date.astimezone(timezone).replace(tzinfo=None)
+        return datetime.fromtimestamp(entry.last_modified)
 
     def url(self, name):
         name = self._normalize_name(self._clean_name(name))