def parse(self, xml, namespace):
        matches = xpath.find_all(xml, self.xpath, namespace)

        if not xml_models.BaseField in self.field_type.__bases__:
            results = CollectionList(type=self.field_type)
            for match in matches:
                results.append(self.field_type(xml=match))
        else:
            field = self.field_type(xpath = '.')
            results = [field.parse(xpath.domify(match), namespace) for match in matches]
        if self.order_by:
            results.sort(lambda a,b : cmp(getattr(a, self.order_by), getattr(b, self.order_by)))
        return results
dataset/ETHPy150Open adlibre/Adlibre-TMS/adlibre_tms/apps/saasu_client/models/base.py/Collection.parse/original