Beispiel #1
0
def getOneSentence(request):
    try:
        data = json.loads(request.body)
        try:
            token = Token.objects.filter(token=data['token']).first()
            user = token.user
        except:
            raise myError('Please Log In.')
        gene_name_one = data['source_name']
        gene_name_two = data['target_name']
        sentenceList = search_one_sentence(gene_name_one, gene_name_two)
        result = {
            'successful': True,
            'data': sentenceList,
            'error': {
                'id': '',
                'msg': '',
            },
        }
    except myError, e:
        result = {
            'successful': False,
            'error': {
                'id': '3',
                'msg': e.value,
            }
        }
Beispiel #2
0
def getOneSentence(request):
	try:
		data = json.loads(request.body)
		try:
			token = Token.objects.filter(token=data['token']).first()
			user = token.user
		except:
			raise myError('Please Log In.')
		gene_name_one = data['source_name']
		gene_name_two = data['target_name']
		sentenceList = search_one_sentence(gene_name_one,gene_name_two)
		result = {
			'successful': True,
			'data': sentenceList,
			'error': {
				'id': '',
				'msg': '',
			},
		}
	except myError, e:
		result = {
			'successful': False,
			'error': {
				'id': '3',
				'msg': e.value,
			}
		}
Beispiel #3
0
	def test_search_one_sentence(self):
		search_result = search_one_sentence('name1', 'name2')
		self.assertEqual(search_result, [])