cc1
v2.1
CC1 source code docs
Main Page
Related Pages
Packages
Classes
Files
File List
All
Classes
Namespaces
Files
Functions
Variables
Pages
farm.py
Go to the documentation of this file.
1
# -*- coding: utf-8 -*-
2
# @COPYRIGHT_begin
3
#
4
# Copyright [2010-2014] Institute of Nuclear Physics PAN, Krakow, Poland
5
#
6
# Licensed under the Apache License, Version 2.0 (the "License");
7
# you may not use this file except in compliance with the License.
8
# You may obtain a copy of the License at
9
#
10
# http://www.apache.org/licenses/LICENSE-2.0
11
#
12
# Unless required by applicable law or agreed to in writing, software
13
# distributed under the License is distributed on an "AS IS" BASIS,
14
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
# See the License for the specific language governing permissions and
16
# limitations under the License.
17
#
18
# @COPYRIGHT_end
19
20
##
21
# @package src.clm.views.admin_cm.farm
22
#
23
24
from
clm.utils.decorators
import
admin_cm_log, cm_request
25
from
clm.models.user
import
User
26
from
clm.utils.exception
import
CLMException
27
28
29
@
admin_cm_log
(log=
False
)
30
@cm_request
31
##
32
#
33
# @clmview_admin_cm
34
# @cm_request_transparent{farm.get_list()}
35
#
36
def
get_list
(cm_response, **data):
37
if
cm_response[
'status'
] !=
'ok'
:
38
raise
CLMException(
'cm_error'
)
39
40
names = {}
41
for
farm
in
cm_response[
"data"
]:
42
if
str(farm[
'user_id'
])
not
in
names:
43
try
:
44
user = User.objects.get(pk=farm[
'user_id'
])
45
names[str(farm[
'user_id'
])] =
"%s %s"
% (user.first, user.last)
46
except
:
47
raise
CLMException(
'user_get'
)
48
farm[
"owner"
] = names[str(farm[
"user_id"
])]
49
50
return
cm_response[
"data"
]
51
52
53
@
admin_cm_log
(log=
True
, pack=
False
)
54
@cm_request
55
##
56
#
57
# @clmview_admin_cm
58
# @cm_request_transparent{farm.destroy()}
59
#
60
def
destroy
(cm_response, **data):
61
return
cm_response
62
63
64
@
admin_cm_log
(log=
True
, pack=
False
)
65
@cm_request
66
##
67
#
68
# @clmview_admin_cm
69
# @cm_request_transparent{farm.get_by_id()}
70
#
71
def
get_by_id
(cm_response, **data):
72
return
cm_response
73
74
75
@
admin_cm_log
(log=
True
, pack=
False
)
76
@cm_request
77
##
78
#
79
# @clmview_admin_cm
80
# @cm_request_transparent{farm.erase()}
81
#
82
def
erase
(cm_response, **data):
83
return
cm_response
84
85
86
@
admin_cm_log
(log=
True
, pack=
False
)
87
@cm_request
88
##
89
#
90
# @clmview_admin_cm
91
# @cm_request_transparent{farm.save_and_shutdown()}
92
#
93
def
save_and_shutdown
(cm_response, **data):
94
return
cm_response
95
clm
views
admin_cm
farm.py
Generated on Wed Jun 18 2014 13:32:58 for cc1 by
1.8.1.2