Project

General

Profile

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

root / wcsinst / wcsinstd / views.py @ 3d53199c

1
import json
2
import logging
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
logger = logging.getLogger(__name__)
12

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

    
22

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