def item_info(self): with dictcursor() as cur: cur.execute( "SELECT item.id, item.price, item.color FROM item WHERE item.id=%s", (self.id,)) data = cur.fetchone() data["ratio"] = image_ratio(self.product_image_path) return data
def __add_thumb_ratio(self, info_list): for i in info_list: ratio = image_ratio(VideoContent(i['id']).thumb_path('mobile')) i['thumb_ratio'] = ratio return info_list