change today variable
This commit is contained in:
parent
f9c03174af
commit
bb258450bc
1 changed files with 8 additions and 4 deletions
12
workdirfs.py
12
workdirfs.py
|
@ -26,26 +26,30 @@ except:
|
||||||
class WorkdirFS(Operations):
|
class WorkdirFS(Operations):
|
||||||
def __init__(self, args):
|
def __init__(self, args):
|
||||||
self.args = args
|
self.args = args
|
||||||
|
self.today = datetime.now() - timedelta(hours=self.args.timeoffset)
|
||||||
|
|
||||||
# Helpers
|
# Helpers
|
||||||
# =======
|
# =======
|
||||||
|
|
||||||
def _full_path(self, partial):
|
def _full_path(self, partial):
|
||||||
today = datetime.now() - timedelta(hours=self.args.timeoffset)
|
self.today = datetime.now() - timedelta(hours=self.args.timeoffset)
|
||||||
if self.args.yearlydir:
|
if self.args.yearlydir:
|
||||||
path = os.path.join(os.environ['HOME'], self.args.archive,"workdir",today.strftime("%Y"))
|
path = os.path.join(os.environ['HOME'],
|
||||||
|
self.args.archive,"workdir",self.today.strftime("%Y"))
|
||||||
if self.args.monthlydir:
|
if self.args.monthlydir:
|
||||||
path = os.path.join(path, today.strftime("%m"))
|
path = os.path.join(path, self.today.strftime("%m"))
|
||||||
else:
|
else:
|
||||||
path = os.path.join(os.environ['HOME'], self.args.archive, "workdir")
|
path = os.path.join(os.environ['HOME'], self.args.archive, "workdir")
|
||||||
|
|
||||||
if partial.startswith("/"):
|
if partial.startswith("/"):
|
||||||
partial = partial[1:]
|
partial = partial[1:]
|
||||||
|
|
||||||
path = os.path.join(check_dir(os.path.join(path, today.strftime("%Y-%m-%d"))), partial)
|
path = os.path.join(check_dir(os.path.join(path, self.today.strftime("%Y-%m-%d"))), partial)
|
||||||
|
|
||||||
return path
|
return path
|
||||||
|
|
||||||
|
def _full_content_path(self, partial):
|
||||||
|
|
||||||
# Filesystem methods
|
# Filesystem methods
|
||||||
# ==================
|
# ==================
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue