def _parseBox(self, elem): for key in elem.attributes.keys(): if key in Game.FIELDS: val = elem.attributes[key].value if key == 'date': val = DateFromTicks(mktime(strptime(val, '%B %d, %Y'))) elif val.isdigit(): val = int(val) else: val = str(val) setattr(self, key, val)