mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-12 21:30:39 +00:00
Handle exception when converting timestamp to datetime in translate_seahub_time tag
This commit is contained in:
@@ -169,7 +169,10 @@ def translate_seahub_time(value):
|
||||
|
||||
if isinstance(value, int) or isinstance(value, long): # check whether value is int
|
||||
val_ts = value
|
||||
val = datetime.fromtimestamp(val_ts) # convert timestamp to datetime
|
||||
try:
|
||||
val = datetime.fromtimestamp(val_ts) # convert timestamp to datetime
|
||||
except ValueError as e:
|
||||
return ""
|
||||
elif isinstance(value, datetime):
|
||||
# FIXME: convert datetime to timestamp may cause problem, need a better way.
|
||||
val_ts = int(time.mktime(value.timetuple()))
|
||||
|
Reference in New Issue
Block a user