def unshelve(): d = shelve.open(shelf_path()) today = datetime.now().date() day = d.get("day", Day(today)) week = d.get("week", Week()) if day.date!=today and not day.last_session().status(): # Save data from old day in week object week.add_day(WorkDay(day)) week.clean() d["week"] = week # Make a new day instance day = Day(today) logging.info("Making a new day %s" % day.date) d.close() return day,week
def unshelve(): d = shelve.open(shelf_path()) today = datetime.now().date() day = d.get("day", Day(today)) week = d.get("week", Week()) if day.date != today and not day.last_session().status(): # Save data from old day in week object week.add_day(WorkDay(day)) week.clean() d["week"] = week # Make a new day instance day = Day(today) logging.info("Making a new day %s" % day.date) d.close() return day, week
def reshelve(day, week): d = shelve.open(shelf_path()) d["week"] = week d["day"] = day d.close()