fix annotation import, values are decoded in d1.9

This commit is contained in:
j 2016-03-05 15:36:39 +05:30
parent a8dcbbbe89
commit 4f28c2c548
2 changed files with 3 additions and 4 deletions

View file

@ -1,6 +1,5 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# vi:si:et:sw=4:sts=4:ts=4 # vi:si:et:sw=4:sts=4:ts=4
import json
import ox import ox
from django.conf import settings from django.conf import settings
@ -28,12 +27,12 @@ def update_matches(id, type):
a_matches.add(Model.get_or_create(a.value)) a_matches.add(Model.get_or_create(a.value))
for p in a_matches.all(): for p in a_matches.all():
p.update_matches() p.update_matches()
if a.findvalue: if a.findvalue:
names = {} names = {}
for n in Model.objects.all().values('id', 'name', 'alternativeNames'): for n in Model.objects.all().values('id', 'name', 'alternativeNames'):
names[n['id']] = [ox.decode_html(x) names[n['id']] = [ox.decode_html(x)
for x in [n['name']] + json.loads(n['alternativeNames'])] for x in (n['name'],) + n['alternativeNames']]
value = a.findvalue.lower() value = a.findvalue.lower()
current = [p.id for p in a_matches.all()] current = [p.id for p in a_matches.all()]

View file

@ -368,7 +368,7 @@ def getTaskStatus(request, data):
if status in default_backend.EXCEPTION_STATES: if status in default_backend.EXCEPTION_STATES:
traceback = default_backend.get_traceback(task_id) traceback = default_backend.get_traceback(task_id)
response['data'].update({ response['data'].update({
'result': str(res.args[0]), 'result': str(res),
'exc': get_full_cls_name(res.__class__), 'exc': get_full_cls_name(res.__class__),
'traceback': traceback 'traceback': traceback
}) })