Added a catch for errors in reading the last_log data
This commit is contained in:
parent
760b36a137
commit
8e0ed54899
6
cspc.py
6
cspc.py
|
@ -197,7 +197,7 @@ def get_posts():
|
|||
v = (topic,)
|
||||
res = db_do(q, v)
|
||||
print('{}{:^6} {:35} {:12} {:18}{}'.format(c.yellow, 'ID', 'Post Title', 'Author', 'Last Updated', c.end))
|
||||
print('{}-----------------------------------------------------------------------------{}'.format( c.yellow, c.end))
|
||||
print('{}------------------------------------------------------------------------------{}'.format( c.yellow, c.end))
|
||||
if not len(res):
|
||||
print('\n{}There are no posts for this topic yet. Add one!{}'.format(c.cyan, c.end))
|
||||
else:
|
||||
|
@ -207,7 +207,7 @@ def get_posts():
|
|||
title = row[1]
|
||||
if len(title) > 35:
|
||||
title = '{}...'.format(title[:32])
|
||||
if last_log > row[3]:
|
||||
if last_log > row[3] or not last_log:
|
||||
print('({:^4}) {:35} {:12} {:18}'.format(row[0], title, row[2], dtime))
|
||||
else:
|
||||
print('({:^4}) {:35} {:12} {}{:18}{}'.format(row[0], title, row[2], c.green, dtime, c.end))
|
||||
|
@ -228,7 +228,7 @@ def get_topics():
|
|||
title = row[0]
|
||||
if len(title) > 35:
|
||||
title = '{}...'.format(title[:32])
|
||||
if last_log > row[1]:
|
||||
if last_log > row[1] or not last_log:
|
||||
print('({:^4}) {}{:35}{} {:18}'.format(row[2], c.cyan, title, c.end, dtime))
|
||||
else:
|
||||
print('({:^4}) {}{:35} {}{:18}{}'.format(row[2], c.cyan, title, c.green, dtime, c.end))
|
||||
|
|
Loading…
Reference in New Issue