def save(self): id = self.get_image_id() if not id: return 0 pins = Pins() pins.data['pin_id'] = id pins.data['image_url'] = self.get_image() pins.data['description'] = self.get_description() pins.data['refer_url'] = self.get_refer_url() if not pins.save(): return 0 repins = self.get_repins() wordcount = {} for user in repins: words = Words() words.data['pin_id'] = id words.data['user'] = user # delete and insert in preperation for change of board name. words.delete() for w in repins[user]: words.data['word'] = w words.save() return 1