def current(self, d): [annual, monthly, longterm] = Goal.Current(self.user) self.set_response({ 'annual': annual.json() if annual else None, 'monthly': monthly.json() if monthly else None, 'longterm': longterm.json() if longterm else None }, success=True)
def _goals_request(self): [annual, monthly, longterm] = Goal.Current(self.user) speech = None g = None if monthly: g = monthly speech = "Goals for %s. " % datetime.strftime(g.date, "%B %Y") elif annual: g = annual speech = "Goals for %s. " % g.year() if g: if g.text: for i, text in enumerate(g.text): speech += "%d: %s. " % (i + 1, text) else: speech = "No goals yet" else: speech = "You haven't set up any goals yet. " + GOAL.SET_INFO return speech