All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johannes Erdfelt <johannes@erdfelt.com>
To: ceph-devel@vger.kernel.org
Subject: [PATCH] Python Ioctx.get_xattrs does not take xattr_name
Date: Tue, 9 Jul 2013 08:15:33 -0700	[thread overview]
Message-ID: <20130709151533.GN2650@sventech.com> (raw)

Fixes bug 5528

Since it returns all xattrs, it does not take an xattr_name. Also,
add unit tests for the Object xattrs methods.

Signed-off-by: Johannes Erdfelt <johannes@erdfelt.com>
---
 src/pybind/rados.py           |  4 ++--
 src/test/pybind/test_rados.py | 12 ++++++++++++
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/src/pybind/rados.py b/src/pybind/rados.py
index 13badc9..0ba8184 100644
--- a/src/pybind/rados.py
+++ b/src/pybind/rados.py
@@ -1566,9 +1566,9 @@ class Object(object):
         return self.ioctx.get_xattr(self.key, xattr_name)
 
     @set_object_locator
-    def get_xattrs(self, xattr_name):
+    def get_xattrs(self):
         self.require_object_exists()
-        return self.ioctx.get_xattrs(self.key, xattr_name)
+        return self.ioctx.get_xattrs(self.key)
 
     @set_object_locator
     def set_xattr(self, xattr_name, xattr_value):
diff --git a/src/test/pybind/test_rados.py b/src/test/pybind/test_rados.py
index f182524..01b6a21 100644
--- a/src/test/pybind/test_rados.py
+++ b/src/test/pybind/test_rados.py
@@ -117,6 +117,18 @@ class TestIoctx(object):
             stored_xattrs[key] = value
         eq(stored_xattrs, xattrs)
 
+    def test_obj_xattrs(self):
+        xattrs = dict(a='1', b='2', c='3', d='a\0b', e='\0')
+        self.ioctx.write('abc', '')
+        obj = list(self.ioctx.list_objects())[0]
+        for key, value in xattrs.iteritems():
+            obj.set_xattr(key, value)
+            eq(obj.get_xattr(key), value)
+        stored_xattrs = {}
+        for key, value in obj.get_xattrs():
+            stored_xattrs[key] = value
+        eq(stored_xattrs, xattrs)
+
     def test_create_snap(self):
         assert_raises(ObjectNotFound, self.ioctx.remove_snap, 'foo')
         self.ioctx.create_snap('foo')
-- 
1.8.3.1


             reply	other threads:[~2013-07-09 15:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-09 15:15 Johannes Erdfelt [this message]
2013-07-10 20:46 ` [PATCH] Python Ioctx.get_xattrs does not take xattr_name Josh Durgin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130709151533.GN2650@sventech.com \
    --to=johannes@erdfelt.com \
    --cc=ceph-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.