Juan Hernandez has uploaded a new change for review.

Change subject: sdk: Use "io.BytesIO" instead of "StringIO"
......................................................................

sdk: Use "io.BytesIO" instead of "StringIO"

This is one step towards adding support for Python 3.

Change-Id: I56b30bcba9dd7cf680427ad9a0898a49410d4361
Signed-off-by: Juan Hernandez <juan.hernan...@redhat.com>
---
M src/ovirtsdk/infrastructure/connectionspool.py
M src/ovirtsdk/utils/parsehelper.py
2 files changed, 7 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine-sdk refs/changes/27/41327/1

diff --git a/src/ovirtsdk/infrastructure/connectionspool.py 
b/src/ovirtsdk/infrastructure/connectionspool.py
index 0bb688d..fbcc8aa 100644
--- a/src/ovirtsdk/infrastructure/connectionspool.py
+++ b/src/ovirtsdk/infrastructure/connectionspool.py
@@ -14,7 +14,7 @@
 # limitations under the License.
 #
 
-import cStringIO
+import io
 import pycurl
 import threading
 
@@ -123,8 +123,8 @@
         self.__curl.setopt(pycurl.POSTFIELDS, body if body is not None else "")
 
         # Prepare the buffers to receive the response:
-        body_buffer = cStringIO.StringIO()
-        headers_buffer = cStringIO.StringIO()
+        body_buffer = io.BytesIO()
+        headers_buffer = io.BytesIO()
         self.__curl.setopt(pycurl.WRITEFUNCTION, body_buffer.write)
         self.__curl.setopt(pycurl.HEADERFUNCTION, headers_buffer.write)
 
diff --git a/src/ovirtsdk/utils/parsehelper.py 
b/src/ovirtsdk/utils/parsehelper.py
index 97e2d86..40903e3 100644
--- a/src/ovirtsdk/utils/parsehelper.py
+++ b/src/ovirtsdk/utils/parsehelper.py
@@ -14,11 +14,12 @@
 # limitations under the License.
 #
 
-import StringIO
+import io
+import sys
+
 from ovirtsdk.infrastructure import common
 from ovirtsdk.utils.reflectionhelper import ReflectionHelper
 from ovirtsdk.xml import params
-import sys
 
 class ParseHelper():
     '''Provides parsing capabilities'''
@@ -49,7 +50,7 @@
             )
 
         # Generate the XML document:
-        output = StringIO.StringIO()
+        output = io.BytesIO()
         entity.export_(output, 0, name_=entity_tag)
         return output.getvalue()
 


-- 
To view, visit https://gerrit.ovirt.org/41327
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I56b30bcba9dd7cf680427ad9a0898a49410d4361
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine-sdk
Gerrit-Branch: master
Gerrit-Owner: Juan Hernandez <juan.hernan...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to