[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
This commit is contained in:
becue 2012-08-08 00:35:40 +02:00
parent 668ba63330
commit 8eb149db63

View file

@ -101,8 +101,26 @@ class Nols(object):
tree = ElementTree(root) tree = ElementTree(root)
Objects = tree.findall("OBJECT[@name='volume-view']") Objects = tree.findall("OBJECT[@name='volume-view']")
for Object in Objects: for Object in Objects:
name = Object.findall("PROPERTY[@name='volume-name']")[0].text # Quand on passera à wheezy, décommenter ces lignes, et virer
lun = Object.findall("OBJECT/PROPERTY[@name='lun']")[0].text # 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: if lun is None:
pass pass
else: else: