quick fix for date with prefix

This commit is contained in:
Sanj 2012-04-24 16:03:22 +05:30
parent ca3ac107a2
commit fb51dca89c

View File

@ -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