cc1  v2.1
CC1 source code docs
All Classes Namespaces Files Functions Variables Pages
iso_image.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.iso_image
22 # @alldecoratedby{src.clm.utils.decorators.admin_cm_log}
23 #
24 from clm.utils.decorators import admin_cm_log, cm_request
25 from clm.utils.exception import CLMException
26 from clm.models.user import User
27 
28 
29 @admin_cm_log(log=False, pack=True)
30 @cm_request
31 ##
32 #
33 # @cm_request{iso_image.get_list()}
34 #
35 # @clmview_admin_cm
36 #
37 def get_list(cm_response, **data):
38  names = {}
39 
40  for img in cm_response['data']:
41  if str(img['user_id']) not in names:
42  try:
43  user = User.objects.get(pk=img['user_id'])
44  names[str(img['user_id'])] = user.first + " " + user.last
45  except:
46  raise CLMException('user_get')
47  img['owner'] = names[str(img['user_id'])]
48 
49  return cm_response['data']
50 
51 
52 @admin_cm_log(log=False, pack=False)
53 @cm_request
54 ##
55 #
56 # @clmview_admin_cm
57 # @cm_request_transparent{iso_image.get_by_id()}
58 #
59 def get_by_id(cm_response, **data):
60  return cm_response
61 
62 
63 @admin_cm_log(log=True, pack=False)
64 @cm_request
65 ##
66 #
67 # @clmview_admin_cm
68 # @cm_request_transparent{iso_image.delete()}
69 #
70 def delete(cm_response, **data):
71  return cm_response
72 
73 
74 @admin_cm_log(log=True, pack=False)
75 @cm_request
76 ##
77 #
78 # @clmview_admin_cm
79 # @cm_request_transparent{iso_image.edit()}
80 #
81 def edit(cm_response, **data):
82  return cm_response
83 
84 
85 @admin_cm_log(log=True, pack=False)
86 @cm_request
87 ##
88 #
89 # @clmview_admin_cm
90 # @cm_request_transparent{iso_image.download()}
91 #
92 def download(cm_response, **data):
93  return cm_response
94 
95 
96 @admin_cm_log(log=True, pack=False)
97 @cm_request
98 ##
99 #
100 # @clmview_admin_cm
101 # @cm_request_transparent{iso_image.copy()}
102 #
103 def copy(cm_response, **data):
104  return cm_response
105 
106 
107 @admin_cm_log(log=True, pack=False)
108 @cm_request
109 ##
110 #
111 # @clmview_admin_cm
112 # @cm_request_transparent{iso_image.set_public()}
113 #
114 def set_public(cm_response, **data):
115  return cm_response
116 
117 
118 @admin_cm_log(log=True, pack=False)
119 @cm_request
120 ##
121 #
122 # @clmview_admin_cm
123 # @cm_request_transparent{iso_image.set_private()}
124 #
125 def set_private(cm_response, **data):
126  return cm_response
127