def save(when, day): if isinstance(when, basestring): when = util.string_to_date(when) if when is None: raise Exception("need to specify a day to save for") data = load_file(when) data[day['id']] = day save_file(data, when)
def load(when=None): if isinstance(when, basestring): when = util.string_to_date(when) if when is None: when = datetime.date.today() generate_file(when) data = load_file(when) today = when.strftime("%Y-%m-%d") return data[today]