Project

General

Profile

Download (705 Bytes) Statistics
| Branch: | Tag: | Revision:

root / wcsinst / wcsinstd / views.py @ f3093ed1

1
import json
2
import threading
3

    
4
from django.views.decorators.csrf import csrf_exempt
5
from django.views.decorators.http import require_POST
6

    
7
from jsonresponse import to_json
8

    
9
from .deploy import DeployInstance
10

    
11

    
12
@csrf_exempt
13
@to_json('api')
14
@require_POST
15
def create(request):
16
    data = json.loads(request.body)
17
    deploy = DeployInstance(**data)
18
    deploy.make()
19
    return {}
20

    
21

    
22
@csrf_exempt
23
@to_json('api')
24
@require_POST
25
def update(request, instance):
26
    print 'updating instance:', instance
27
    data = json.loads(request.body)
28
    if data.get('domain') != instance:
29
        raise Exception('domain mismatch') # -> should remove/add ?
30
    deploy = DeployInstance(**data)
31
    deploy.make()
32
    return {}
(6-6/6)