Statistics
| Branch: | Tag: | Revision:

root / commissioning / servers / fscrud / fscrud_django / callpoint.py @ 9619cc64

History | View | Annotate | Download (1.6 kB)

1

    
2
from commissioning import ControlledCallpoint, get_callpoint, mkcallargs
3
from commissioning.controllers.django_controller \
4
    import Controller as DjangoController
5
from commissioning.specs.fscrud import API_Spec as FSCrudAPI
6
from commissioning.physicals.fscrud import FSCrudPhysical
7
from django.conf import settings
8

    
9

    
10
qh_callpoint = get_callpoint('clients.quotaholder', automake='http')
11
fscrud_api_spec = FSCrudAPI()
12

    
13
class FSCrudDjangoController(DjangoController):
14

    
15
    def controller_init(self):
16
        self.context = {}
17
        self.clientkey = 'fscrudck'
18
        self.entitykey = 'fscrudek'
19
        self.entityroot = 'fscrud'
20

    
21
    def get_commission_issue(self, commission_spec):
22
        call_data = commission_spec['call_data']
23
        path = call_data['path']
24
        args = mkcallargs (
25
                context     =   self.context,
26
                entity      =   path,
27
                key         =   self.entitykey,
28
                clientkey   =   self.clientkey,
29
                owner       =   self.entityroot,
30
                ownerkey    =   self.entitykey,
31
                provisions  =   [('access', 'path', 1)]
32
        )
33

    
34
        return args
35

    
36

    
37
class FSCrudControlled(ControlledCallpoint):
38

    
39
    api_spec = fscrud_api_spec
40

    
41
    def init_connection(self, connection):
42
        # ignore connection
43
        queuepath = settings.FSCRUD_QUEUE_PATH
44
        dataroot = settings.FSCRUD_DATA_ROOT
45
        physical = FSCrudPhysical(queuepath, dataroot)
46
        quotaholder = qh_callpoint('null://wherever/')
47
        self.controller = FSCrudDjangoController(quotaholder, physical)
48

    
49
    def commit(self):
50
        pass
51

    
52
    def rollback(self):
53
        pass
54

    
55
API_Callpoint = FSCrudControlled
56