Improved debug print for node importer

This commit is contained in:
2015-09-25 10:46:28 +02:00
parent c2e0ae4002
commit 89a9509657

View File

@@ -476,6 +476,7 @@ def populate_node_types(old_ids={}):
'category': { 'category': {
'type': 'string', 'type': 'string',
'allowed': [ 'allowed': [
'training',
'film', 'film',
'assets', 'assets',
'software', 'software',
@@ -736,7 +737,7 @@ def add_node_asset(file_id):
@manager.command @manager.command
def import_data(path): def import_data(path):
import json import json
import os import pprint
from bson import json_util from bson import json_util
if not os.path.isfile(path): if not os.path.isfile(path):
return "File does not exist" return "File does not exist"
@@ -766,6 +767,8 @@ def import_data(path):
r = post_item(collection, f) r = post_item(collection, f)
if r[0]['_status'] == 'ERR': if r[0]['_status'] == 'ERR':
print r[0]['_issues'] print r[0]['_issues']
print "Tried to commit the following object"
pprint.pprint(f)
# Assign the Mongo ObjectID # Assign the Mongo ObjectID
f['_id'] = str(r[0]['_id']) f['_id'] = str(r[0]['_id'])
@@ -776,7 +779,10 @@ def import_data(path):
f['asset_id'] = asset_id f['asset_id'] = asset_id
if node_id: if node_id:
f['node_id'] = node_id f['node_id'] = node_id
try:
print "{0} {1}".format(f['_id'], f['name']) print "{0} {1}".format(f['_id'], f['name'])
except UnicodeEncodeError:
print "{0}".format(f['_id'])
return f return f
# Build list of parent files # Build list of parent files
@@ -924,7 +930,7 @@ def make_thumbnails():
#print "Skipping {0}".format(f['path']) #print "Skipping {0}".format(f['path'])
else: else:
print "Building {0}".format(f['path']) print "Building {0}".format(f['path'])
t = build_thumbnails(f['path']) t = build_thumbnails(file_path=f['path'])
print t print t