コード例 #1
0
ファイル: main.py プロジェクト: 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
コード例 #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
コード例 #3
0
ファイル: main.py プロジェクト: sw561/tomato
def reshelve(day, week):
	d = shelve.open(shelf_path())
	d["week"] = week
	d["day"] = day
	d.close()
コード例 #4
0
def reshelve(day, week):
    d = shelve.open(shelf_path())
    d["week"] = week
    d["day"] = day
    d.close()