Commit 8eb149db authored by Pierre-Elliott Bécue's avatar Pierre-Elliott Bécue
Browse files

[Nolslib] Python 2.6 n'implémente pas l'écriture [@attrib='value']

Ignore-this: 60e19bc82fad22afde3dc989c0526f7c

Avec python 2.7, Element.find("BLOB[@attrib='value']") marche bien, mais python 2.6 n'inclut pas ce qu'il faut, du coup, je fais un patch moche.

darcs-hash:20120807223540-ab199-c08efe7455373e7d996d19bded05efaa4dfbb79d.gz
parent 668ba633
......@@ -101,8 +101,26 @@ class Nols(object):
tree = ElementTree(root)
Objects = tree.findall("OBJECT[@name='volume-view']")
for Object in Objects:
name = Object.findall("PROPERTY[@name='volume-name']")[0].text
lun = Object.findall("OBJECT/PROPERTY[@name='lun']")[0].text
# Quand on passera à wheezy, décommenter ces lignes, et virer
# la merde que j'ai fait juste après.
#name = Object.findall("PROPERTY[@name='volume-name']")[0].text
#lun = Object.findall("OBJECT/PROPERTY[@name='lun']")[0].text
properties = Object.findall("PROPERTY")
for property in properties:
if property.attrib['name'] == "volume-name":
name = property.text
else:
pass
subObjects = Object.findall("OBJECT")
for subObject in subObjects:
properties = subObject.findall("PROPERTY")
for property in properties:
if property.attrib['name'] == "lun":
lun = property.text
else:
pass
if lun is None:
pass
else:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment