configs and experiments
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
from django.http import HttpResponse, JsonResponse
|
||||
|
||||
from BaseLib.BaseView import BaseView
|
||||
from Platform import settings
|
||||
from experiments.models import Experiment
|
||||
|
||||
|
||||
@@ -39,4 +42,21 @@ class ExperimentsView(BaseView):
|
||||
else:
|
||||
exp.condition = 'True'
|
||||
exp.save()
|
||||
return '/experiments/?stage=' + self.stage
|
||||
return '/experiments/?stage=' + self.stage
|
||||
|
||||
|
||||
def get_experiment(request):
|
||||
if request.headers.get("X-Security-Token") != settings.PLATFORM_SECURITY_TOKEN:
|
||||
return HttpResponse('', status=403)
|
||||
project = request.GET.get('project')
|
||||
stage = request.GET.get('stage')
|
||||
name = request.GET.get('name')
|
||||
if project is None or stage is None or name is None:
|
||||
return HttpResponse('', status=400)
|
||||
experiment = Experiment.objects.filter(stage=stage, project=project, name=name).first()
|
||||
if experiment is None:
|
||||
return HttpResponse('', status=404)
|
||||
return JsonResponse({
|
||||
'enabled': experiment.enabled,
|
||||
'condition': experiment.condition
|
||||
})
|
||||
|
Reference in New Issue
Block a user