diff options
author | Narayan Desai <desai@mcs.anl.gov> | 2004-10-29 15:13:44 +0000 |
---|---|---|
committer | Narayan Desai <desai@mcs.anl.gov> | 2004-10-29 15:13:44 +0000 |
commit | e825d589c7cf55c95029d99822e71437fd3a79c6 (patch) | |
tree | 5838a55d01ce97fe878aa1e561f1a366bb7aed8a /src | |
parent | cdca16ba93e874e6fcc736731d379e0bde7a6f88 (diff) | |
download | bcfg2-e825d589c7cf55c95029d99822e71437fd3a79c6.tar.gz bcfg2-e825d589c7cf55c95029d99822e71437fd3a79c6.tar.bz2 bcfg2-e825d589c7cf55c95029d99822e71437fd3a79c6.zip |
make hierarchical files work
(Logical change 1.123)
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@552 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/Server/Structures/Base.py | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/lib/Server/Structures/Base.py b/src/lib/Server/Structures/Base.py index 9c6eaf573..16719e424 100644 --- a/src/lib/Server/Structures/Base.py +++ b/src/lib/Server/Structures/Base.py @@ -14,14 +14,17 @@ class BaseFile(SingleXMLFileBacked): def Index(self): '''Store XML data in reasonable structures''' - self.store = {} + self.store = {'Class':{'all':[]}, 'Image':{'all':[]}, 'all':[]} for entry in XML(self.data).getchildren(): - self.store[entry.tag][entry.get('name')] = {'all':[], 'Class':{}} - for child in entry.getchildren(): - if child.tag in ['Image', 'Class']: - self.store[entry.tag][child.tag][child.get('name')] = child.getchildren() - else: - self.store[entry.tag]['all'].append(child) + self.store[entry.tag][entry.get('name')] = {'all':[], 'Class':{}, 'Image':{}} + if entry.tag in ['Image', 'Class']: + for child in entry.getchildren(): + if child.tag in ['Image', 'Class']: + self.store[entry.tag][entry.get('name')][child.tag][child.get('name')] = child.getchildren() + else: + self.store[entry.tag][entry.get('name')]['all'].append(child) + else: + self.store[entry.tag]['all'].append(child) def Construct(self, metadata): '''Build structures for client described by metadata''' |