fix for empty yesterday-file
This commit is contained in:
parent
57611fa5fc
commit
1795317d9c
1 changed files with 7 additions and 3 deletions
10
workdirfs.py
10
workdirfs.py
|
@ -95,14 +95,18 @@ class WorkdirFS(Operations):
|
||||||
def _give_me_yesterday(self):
|
def _give_me_yesterday(self):
|
||||||
if os.path.exists(self.configlast):
|
if os.path.exists(self.configlast):
|
||||||
with open(self.configlast, 'r') as fh:
|
with open(self.configlast, 'r') as fh:
|
||||||
self.yesterday = datetime.strptime(fh.readline().strip(), "%Y-%m-%d")
|
yesterday = fh.readline().strip()
|
||||||
|
if self.yesterday == None:
|
||||||
|
self.yesterday = self.today
|
||||||
|
else:
|
||||||
|
self.yesterday = datetime.strptime(yesterday, "%Y-%m-%d")
|
||||||
else:
|
else:
|
||||||
self.yesterday = self.today
|
self.yesterday = self.today
|
||||||
self._checkdir(self.confdir)
|
self._checkdir(self.confdir)
|
||||||
if not os.path.isdir(self.confdir):
|
if not os.path.isdir(self.confdir):
|
||||||
os.mkdir(self.confdir)
|
os.mkdir(self.confdir)
|
||||||
with open(self.configlast, 'w') as fh:
|
with open(self.configlast, 'w') as fh:
|
||||||
fh.write(self.yesterday.date().strftime("%Y-%m-%d"))
|
fh.write(self.yesterday.date().strftime("%Y-%m-%d"))
|
||||||
return self.yesterday
|
return self.yesterday
|
||||||
|
|
||||||
def _give_me_archivpath(self, _date=None):
|
def _give_me_archivpath(self, _date=None):
|
||||||
|
|
Loading…
Reference in a new issue