All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Support python3 dictionary access.
@ 2018-04-13 18:56 Lee Duncan
  2018-04-16  8:57 ` Sagi Grimberg
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Lee Duncan @ 2018-04-13 18:56 UTC (permalink / raw)


Support python2 and python3 dictionary
access by using the 'python-six' module's
iteritems() function.

Also, add info to the README about supporting
both Python2 and Python3.

Signed-off-by: Lee Duncan <lduncan at suse.com>
---
 README        | 8 +++++---
 nvmet/nvme.py | 3 ++-
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/README b/README
index cd4bd7838637..920a4ad40d91 100644
--- a/README
+++ b/README
@@ -14,9 +14,11 @@ using setup.py.
 
 Common Package Dependencies and Problems
 -----------------------------------------
-nvmetcli uses the 'python-six' and 'pyparsing' packages
-(running nvmetcli without these packages may produce
-hard-to-decipher errors).
+Both python2 and python3 are supported via use of the
+'python-six' package. 
+
+nvmetcli uses the 'pyparsing' package -- running nvmetcli
+without this package may produce hard-to-decipher errors.
 
 Usage
 -----
diff --git a/nvmet/nvme.py b/nvmet/nvme.py
index c245a4240dd9..8253ea9264b7 100644
--- a/nvmet/nvme.py
+++ b/nvmet/nvme.py
@@ -23,6 +23,7 @@ import stat
 import uuid
 import json
 from glob import iglob as glob
+from six import iteritems
 
 DEFAULT_SAVE_FILE = '/etc/nvmet/config.json'
 
@@ -219,7 +220,7 @@ class CFSNode(object):
 
     def _setup_attrs(self, attr_dict, err_func):
         for group in self.attr_groups:
-            for name, value in attr_dict.get(group, {}).iteritems():
+            for name, value in iteritems(attr_dict.get(group, {})):
                 try:
                     self.set_attr(group, name, value)
                 except CFSError as e:
-- 
2.13.6

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] Support python3 dictionary access.
  2018-04-13 18:56 [PATCH] Support python3 dictionary access Lee Duncan
@ 2018-04-16  8:57 ` Sagi Grimberg
  2018-04-16 11:35 ` Johannes Thumshirn
  2018-04-17 15:10 ` Christoph Hellwig
  2 siblings, 0 replies; 4+ messages in thread
From: Sagi Grimberg @ 2018-04-16  8:57 UTC (permalink / raw)


Reviewed-by: Sagi Grimberg <sagi at grimberg.me>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] Support python3 dictionary access.
  2018-04-13 18:56 [PATCH] Support python3 dictionary access Lee Duncan
  2018-04-16  8:57 ` Sagi Grimberg
@ 2018-04-16 11:35 ` Johannes Thumshirn
  2018-04-17 15:10 ` Christoph Hellwig
  2 siblings, 0 replies; 4+ messages in thread
From: Johannes Thumshirn @ 2018-04-16 11:35 UTC (permalink / raw)


Thanks for digging into this!

Reviewed-by: Johannes Thumshirn <jthumshirn at suse.de>
-- 
Johannes Thumshirn                                          Storage
jthumshirn at suse.de                                +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 N?rnberg
GF: Felix Imend?rffer, Jane Smithard, Graham Norton
HRB 21284 (AG N?rnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] Support python3 dictionary access.
  2018-04-13 18:56 [PATCH] Support python3 dictionary access Lee Duncan
  2018-04-16  8:57 ` Sagi Grimberg
  2018-04-16 11:35 ` Johannes Thumshirn
@ 2018-04-17 15:10 ` Christoph Hellwig
  2 siblings, 0 replies; 4+ messages in thread
From: Christoph Hellwig @ 2018-04-17 15:10 UTC (permalink / raw)


Thanks,

applied.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-04-17 15:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-13 18:56 [PATCH] Support python3 dictionary access Lee Duncan
2018-04-16  8:57 ` Sagi Grimberg
2018-04-16 11:35 ` Johannes Thumshirn
2018-04-17 15:10 ` Christoph Hellwig

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.