forked from 0x2620/pandora
fix entities with ' in name
This commit is contained in:
parent
785e14082c
commit
c59fb1596f
1 changed files with 3 additions and 2 deletions
|
@ -4,6 +4,7 @@ from __future__ import division
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
||||||
|
import ox
|
||||||
from ox.utils import json
|
from ox.utils import json
|
||||||
from ox.django.decorators import login_required_json
|
from ox.django.decorators import login_required_json
|
||||||
from ox.django.shortcuts import render_to_json_response, get_object_or_404_json, json_response, HttpErrorJson
|
from ox.django.shortcuts import render_to_json_response, get_object_or_404_json, json_response, HttpErrorJson
|
||||||
|
@ -168,7 +169,7 @@ def addAnnotation(request, data):
|
||||||
if layer['canAddAnnotations'].get(request.user.get_profile().get_level()):
|
if layer['canAddAnnotations'].get(request.user.get_profile().get_level()):
|
||||||
if layer['type'] == 'entity':
|
if layer['type'] == 'entity':
|
||||||
try:
|
try:
|
||||||
value = Entity.get_by_name(data['value'], layer['entity']).get_id()
|
value = Entity.get_by_name(ox.decode_html(data['value']), layer['entity']).get_id()
|
||||||
except Entity.DoesNotExist:
|
except Entity.DoesNotExist:
|
||||||
response = json_response({})
|
response = json_response({})
|
||||||
response['status']['text'] = 'unkown entity'
|
response['status']['text'] = 'unkown entity'
|
||||||
|
@ -281,7 +282,7 @@ def editAnnotation(request, data):
|
||||||
if key in data:
|
if key in data:
|
||||||
if key == 'value' and layer['type'] == 'entity':
|
if key == 'value' and layer['type'] == 'entity':
|
||||||
try:
|
try:
|
||||||
value = Entity.get_by_name(data['value'], layer['entity']).get_id()
|
value = Entity.get_by_name(ox.decode_html(data['value']), layer['entity']).get_id()
|
||||||
except Entity.DoesNotExist:
|
except Entity.DoesNotExist:
|
||||||
response = json_response({})
|
response = json_response({})
|
||||||
response['status']['text'] = 'unkown entity'
|
response['status']['text'] = 'unkown entity'
|
||||||
|
|
Loading…
Reference in a new issue