Updated Branches:
  refs/heads/trunk d173f21b8 -> b42a58b8e

Store last_modified timestamp in the Object extra dictionary in the S3 driver.

Contributed by Stefan Friesel, part of LIBCLOUD-373.


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/af8b747a
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/af8b747a
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/af8b747a

Branch: refs/heads/trunk
Commit: af8b747a3d9f3893a9b0d52566acb71a563d57f8
Parents: d173f21
Author: Tomaz Muraus <[email protected]>
Authored: Mon Aug 19 19:37:32 2013 +0200
Committer: Tomaz Muraus <[email protected]>
Committed: Mon Aug 19 19:38:59 2013 +0200

----------------------------------------------------------------------
 CHANGES                          | 4 ++++
 libcloud/storage/drivers/s3.py   | 6 +++++-
 libcloud/test/storage/test_s3.py | 1 +
 3 files changed, 10 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/af8b747a/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 2c1be7c..5f29488 100644
--- a/CHANGES
+++ b/CHANGES
@@ -71,6 +71,10 @@ Changes with Apache Libcloud in development
       and CloudFiles driver. (LIBCLOUD-369)
       [Stefan Friesel]
 
+    - Store last_modified timestamp in the Object extra dictionary in the S3
+      driver. (LIBCLOUD-373)
+      [Stefan Friesel]
+
   *) Load Balancer
 
    - Expose CloudStack driver directly through the Provider.CLOUDSTACK

http://git-wip-us.apache.org/repos/asf/libcloud/blob/af8b747a/libcloud/storage/drivers/s3.py
----------------------------------------------------------------------
diff --git a/libcloud/storage/drivers/s3.py b/libcloud/storage/drivers/s3.py
index db22c7f..9930641 100644
--- a/libcloud/storage/drivers/s3.py
+++ b/libcloud/storage/drivers/s3.py
@@ -881,6 +881,10 @@ class S3StorageDriver(StorageDriver):
                                       namespace=self.namespace)
         meta_data = {'owner': {'id': owner_id,
                                'display_name': owner_display_name}}
+        last_modified = findtext(element=element,
+                                 xpath='LastModified',
+                                 namespace=self.namespace)
+        extra = {'last_modified': last_modified}
 
         obj = Object(name=findtext(element=element, xpath='Key',
                                    namespace=self.namespace),
@@ -888,7 +892,7 @@ class S3StorageDriver(StorageDriver):
                                        namespace=self.namespace)),
                      hash=findtext(element=element, xpath='ETag',
                                    namespace=self.namespace).replace('"', ''),
-                     extra=None,
+                     extra=extra,
                      meta_data=meta_data,
                      container=container,
                      driver=self

http://git-wip-us.apache.org/repos/asf/libcloud/blob/af8b747a/libcloud/test/storage/test_s3.py
----------------------------------------------------------------------
diff --git a/libcloud/test/storage/test_s3.py b/libcloud/test/storage/test_s3.py
index 9de324e..75c6789 100644
--- a/libcloud/test/storage/test_s3.py
+++ b/libcloud/test/storage/test_s3.py
@@ -460,6 +460,7 @@ class S3Tests(unittest.TestCase):
         self.assertEqual(obj.hash, '4397da7a7649e8085de9916c240e8166')
         self.assertEqual(obj.size, 1234567)
         self.assertEqual(obj.container.name, 'test_container')
+        self.assertEqual(obj.extra['last_modified'], 
'2011-04-09T19:05:18.000Z')
         self.assertTrue('owner' in obj.meta_data)
 
     def test_list_container_objects_iterator_has_more(self):

Reply via email to