+ def __getitem__(self, key):
+ if key in self.attributes:
+ if key in self.array_values:
+ return self.attributes[key]
+ elif key in self.int_values:
+ if len(self.attributes[key]) == 1:
+ return int(self.attributes[key][0])
+ else:
+ raise ValueError, 'non-array value has not exactly one value'
+ else:
+ return self.attributes[key][0]
+ elif key in self.defaults:
+ return self.defaults[key]
+ else:
+ raise IndexError