Commit 5dbce846 authored by Eric  DEVEAUD's avatar Eric DEVEAUD

str yaml date to datetime

parent 67176929
......@@ -219,34 +219,14 @@ def history_maker(history_info):
, 'operation' : keyword from 'install', 'remove', 'setdefault', 'unsetdefault', 'update
, 'message' : free text as str }
'''
events = []
for info in history_info:
if not info:
continue
fields = info.split(':')
try:
date, operation = fields[0].split()
except ValueError as msg:
error(WARN, "unknow op", info)
return None
operation=operation.lower()
if operation not in known_ops:
error(WARN, "unknow op", info)
return None
try:
date = arrow.get(date, 'YYYY/MM/DD').naive
info['date'] = arrow.get(info['date'], 'YYYY/MM/DD').naive
except arrow.parser.ParserError as msg:
error(FATAL, date, msg)
message = ' '.join(fields[1:])
mongoevent = {'date': date
, 'operation' : operation
, 'message' : message
}
events.append(mongoevent)
return events
return history_info
def merge_htmldocs (biodocs_lst, module_lst):
'''
......@@ -299,7 +279,7 @@ def pack2mongo(pack):
pack_refs = format_references(pack['references'])
pack_library = MTRUE if pack['library'] else MFALSE
pack_private = MTRUE if pack['private'] else MFALSE
hist = pack['history']
hist = history_maker(pack['history'])
if hist is None:
error(WARN, pack_name, "invalid history")
hist = []
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment