Example #1
0
File: main.py Project: sw561/tomato
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
Example #2
0
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
Example #3
0
File: main.py Project: sw561/tomato
def reshelve(day, week):
	d = shelve.open(shelf_path())
	d["week"] = week
	d["day"] = day
	d.close()
Example #4
0
def reshelve(day, week):
    d = shelve.open(shelf_path())
    d["week"] = week
    d["day"] = day
    d.close()