Repository: libcloud
Updated Branches:
  refs/heads/trunk e6a6676a5 -> 0789cb58d


azure_blobs.py: Apply lxml ElementTree import pattern properly


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

Branch: refs/heads/trunk
Commit: 1588cc738ce472c329f1bba81bdef5ca977e9d64
Parents: 3a20e92
Author: Peter Schmidt <pe...@peterjs.com>
Authored: Fri Apr 22 22:45:31 2016 +1000
Committer: anthony-shaw <anthonys...@apache.org>
Committed: Sat Apr 23 13:13:17 2016 +1000

----------------------------------------------------------------------
 libcloud/storage/drivers/azure_blobs.py | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/1588cc73/libcloud/storage/drivers/azure_blobs.py
----------------------------------------------------------------------
diff --git a/libcloud/storage/drivers/azure_blobs.py 
b/libcloud/storage/drivers/azure_blobs.py
index 13d42f6..4e10df6 100644
--- a/libcloud/storage/drivers/azure_blobs.py
+++ b/libcloud/storage/drivers/azure_blobs.py
@@ -19,7 +19,10 @@ import base64
 import os
 import binascii
 
-from xml.etree.ElementTree import Element, SubElement
+try:
+    from lxml import etree as ET
+except ImportError:
+    from xml.etree import ElementTree as ET
 
 from libcloud.utils.py3 import PY3
 from libcloud.utils.py3 import httplib
@@ -693,10 +696,10 @@ class AzureBlobsStorageDriver(StorageDriver):
         :type upload_id: ``list``
         """
 
-        root = Element('BlockList')
+        root = ET.Element('BlockList')
 
         for block_id in chunks:
-            part = SubElement(root, 'Uncommitted')
+            part = ET.SubElement(root, 'Uncommitted')
             part.text = str(block_id)
 
         data = tostring(root)

Reply via email to