def get(cls, id): row = db.get('SELECT id, name, avatar_url, access_key, access_secret, ' 'handle FROM users WHERE id = %s', int(id)) if not row: return None return cls(**row)
def get(cls, id): row = db.get('SELECT id, food, place, lunch_date, creator_id, slots ' 'FROM lunch WHERE id = %s', int(id)) if not row: return None import logging logging.error(row) instance = cls(**row) #['id'], row['food'], row['place'], row['lunch_date'], #row['creator_id']) tags = LunchTag.get_all(instance.id) instance.tags = tags return instance