From fb51dca89c27bf9b4764a1258860677920e7c6b8 Mon Sep 17 00:00:00 2001 From: Sanj Date: Tue, 24 Apr 2012 16:03:22 +0530 Subject: [PATCH] quick fix for date with prefix --- manifests/ships/convert.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/manifests/ships/convert.py b/manifests/ships/convert.py index 4aa6c01..17168e9 100755 --- a/manifests/ships/convert.py +++ b/manifests/ships/convert.py @@ -120,7 +120,8 @@ def addType(inFile, outFile): outFile.write(outJSON) outFile.close() -def importJSON(filename): +#prefix is a silly quick-fix for date like creekmanifest1201 +def importJSON(filename, prefix=""): data = json.loads(open(filename).read()) errors_ships = [] errors_goods = [] @@ -128,6 +129,8 @@ def importJSON(filename): for manifest in data: m = Manifest() m.filename = manifest['filename'] + if prefix != '': + manifest['date'] = manifest['date'].replace(prefix, "") month = manifest['date'][0:3] yr = manifest['date'][3:5] m.month = month