[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:
parent
668ba63330
commit
8eb149db63
1 changed files with 20 additions and 2 deletions
|
@ -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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue