def fromEtree(cls, etree, xmlconn): dat = {} for item in etree.getchildren(): dat[item.tag] = item.text raw = [] for field in cls._field_order: if field in dat: raw.append(dat[field]) else: raw.append('') source = cls(raw) source.xmlconn = xmlconn return source