Move attachment parsing on the node level

This commit is contained in:
Francesco Siddi 2017-02-27 16:23:21 +01:00
parent e381ca774e
commit 4570b4637b

View File

@ -193,6 +193,9 @@ def view(node_id):
for child in children:
child.picture = get_file(child.picture, api=api)
if 'description' in node:
node['description'] = attachments.render_attachments(node, node['description'])
if request.args.get('format') == 'json':
node = node.to_dict()
node['url_edit'] = url_for('nodes.edit', node_id=node['_id'])
@ -265,9 +268,6 @@ def _view_handler_asset(node, template_path, template_action, link_allowed):
# Treat it as normal file (zip, blend, application, etc)
asset_type = 'file'
if 'description' in node:
node['description'] = attachments.render_attachments(node, node['description'])
template_path = os.path.join(template_path, asset_type)
return template_path, template_action