def get(self, url_id=""): url = Url.get_by_id(int(url_id)) if url is None: raise MissingUrlException("Missing url '%s'" % url_id) user_data = UserData.current() if user_data: goals_updated = GoalList.update_goals(user_data, lambda goal: goal.just_visited_url(user_data, url)) self.redirect(url.url.encode("utf8"))
def init_from_json(self, json): super(GoalObjectiveVisitURL, self).init_from_json(json) obj = Url.get_by_id(json['internal_id']) self.url_id = obj.id self.description = obj.title