fix type error
[sfa.git] / sfa / rspecs / elements / versions / pgv2SliverType.py
index a01607b..ffa4b41 100644 (file)
@@ -19,14 +19,15 @@ class PGv2SliverType:
     
     @staticmethod
     def add_sliver_attributes(xml, attributes):
-        for attribute in attributes:
-            if attribute['name'] == 'initscript':
-                xml.add_element('{%s}initscript' % xml.namespaces['planetlab'], name=attribute['value'])
-            elif tag['tagname'] == 'flack_info':
-                attrib_elem = xml.add_element('{%s}info' % self.namespaces['flack'])
-                attrib_dict = eval(tag['value'])
-                for (key, value) in attrib_dict.items():
-                    attrib_elem.set(key, value)                
+        if attributes: 
+            for attribute in attributes:
+                if attribute['name'] == 'initscript':
+                    xml.add_element('{%s}initscript' % xml.namespaces['planetlab'], name=attribute['value'])
+                elif tag['tagname'] == 'flack_info':
+                    attrib_elem = xml.add_element('{%s}info' % self.namespaces['flack'])
+                    attrib_dict = eval(tag['value'])
+                    for (key, value) in attrib_dict.items():
+                        attrib_elem.set(key, value)                
     @staticmethod
     def get_slivers(xml, filter={}):
         xpath = './default:sliver_type | ./sliver_type'