示例#1
0
def getGene(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_id = data['gene_id']
        get_result = get_gene_info(gene_id)
        result = {
            'successful': get_result[0],
            'data': get_result[1],
            'error': {
                'id': '',
                'msg': '',
            },
        }
    except myError, e:
        result = {
            'successful': False,
            'error': {
                'id': '3',
                'msg': e.value,
            }
        }
示例#2
0
def getGeneInfo(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 = data['gene_name']
		gene = Gene.objects.filter(name=gene_name).first()
		gene_id = gene.gene_id
		get_result = get_gene_info(gene_id)
		result = {
			'successful': get_result[0],
			'data': get_result[1],
			'error': {
				'id': '',
				'msg': '',
			},
		}
	except myError, e:
		result = {
			'successful': False,
			'error': {
				'id': '3',
				'msg': e.value,
			}
		}
示例#3
0
def getGeneInfo(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 = data['gene_name']
        gene = Gene.objects.filter(name=gene_name).first()
        gene_id = gene.gene_id
        get_result = get_gene_info(gene_id)
        result = {
            'successful': get_result[0],
            'data': get_result[1],
            'error': {
                'id': '',
                'msg': '',
            },
        }
    except myError as e:
        result = {
            'successful': False,
            'error': {
                'id': '3',
                'msg': e.value,
            }
        }
    except Exception as e:
        result = {'successful': False, 'error': {'id': '1024', 'msg': e.args}}
    finally:
        return HttpResponse(json.dumps(result),
                            content_type='application/json')
示例#4
0
def getGene(request):
    gid = request.GET.get('id')
    get_result = get_gene_info(gid)
    result = {
        'isSuccessful': get_result[0],
        'info': get_result[1],
    }
    return HttpResponse(json.dumps(result), content_type='application/json')