def update(self, addresses): dao = AddressDao() values = [(a.id,a.name, a.line1,a.line2,a.line3,a.city,a.region,a.country,a.postal_code) for a in addresses] dao.update(values) ids = [(a.id) for a in addresses] ads = self.get(ids) return ads
def insert(self , addresses): dao = AddressDao() values = [(a.name,a.line1,a.line2,a.line3,a.city,a.region,a.country,a.postal_code) for a in addresses] ids = dao.insert(values) ads = self.get(ids) #set the default phone and email types return ads
def get(self,ids=[]): dao = AddressDao() rows = dao.get(ids) addresses = [] for row in rows: addresses.append(Address(row[0],row[1],row[2],row[3],row[4],row[5],row[6],row[7],row[8])) return addresses