69 |
# Get class definition from class name |
# Get class definition from class name |
70 |
# --------------------------------------------------------------------------- |
# --------------------------------------------------------------------------- |
71 |
|
|
72 |
def getClassdef (self, classname): |
def _getClassdef (self, classname): |
73 |
return classrep.classes [classname] |
return classrep.classes [classname] |
74 |
|
|
75 |
# --------------------------------------------------------------------------- |
# --------------------------------------------------------------------------- |
98 |
|
|
99 |
def createList (self, classname): |
def createList (self, classname): |
100 |
|
|
101 |
classdef = self.getClassdef (classname) |
classdef = self._getClassdef (classname) |
102 |
|
|
103 |
# check if user has access rights for this list |
# check if user has access rights for this list |
104 |
if not self._authAdapter.hasAccess (self, self._user, classname): |
if not self._authAdapter.hasAccess (self, self._user, classname): |
112 |
# tr() |
# tr() |
113 |
|
|
114 |
# create new List |
# create new List |
115 |
newlist=geasList.geasList (self, classname) |
newlist = geasList.geasList (self, classdef) |
116 |
# every new list will be added to the _lists list |
# every new list will be added to the _lists list |
117 |
# which will be parsed for commit and rollback actions |
# which will be parsed for commit and rollback actions |
118 |
self._listcount+=1 |
self._listcount += 1 |
119 |
self._lists[self._listcount]=newlist |
self._lists [self._listcount] = newlist |
120 |
return newlist; |
return newlist; |
121 |
|
|
122 |
# --------------------------------------------------------------------------- |
# --------------------------------------------------------------------------- |
181 |
|
|
182 |
def load (self, classname, obj_id_list, propertylist): |
def load (self, classname, obj_id_list, propertylist): |
183 |
# create a temporary geasList |
# create a temporary geasList |
184 |
list = geasList.geasList (self, classname) |
classdef = self._getClassdef (classname) |
185 |
|
list = geasList.geasList (self, classdef) |
186 |
list.setPrefetch (["gnue_id"] + propertylist) |
list.setPrefetch (["gnue_id"] + propertylist) |
187 |
list.setSort (["gnue_id"]) |
list.setSort (["gnue_id"]) |
188 |
# Accessing the database for every single object_id is not very elegant, |
# Accessing the database for every single object_id is not very elegant, |
193 |
['const', object_id]]) |
['const', object_id]]) |
194 |
list.populate () |
list.populate () |
195 |
object = list.firstInstance () |
object = list.firstInstance () |
196 |
row = {} |
row = [] |
197 |
for property in propertylist: |
for property in propertylist: |
198 |
row [property] = object.get (property) |
value = object.get (property) |
199 |
|
## TRANSFER None as "" |
200 |
|
if value == None: |
201 |
|
value = "" |
202 |
|
row.append (value) |
203 |
result.append (row) |
result.append (row) |
204 |
return result |
return result |
205 |
|
|
269 |
|
|
270 |
def call(self,classname,obj_id_list,methodname,parameters): |
def call(self,classname,obj_id_list,methodname,parameters): |
271 |
# create a temporary geasList |
# create a temporary geasList |
272 |
list = geasList.geasList (self, classname) |
classdef = self._getClassdef (classname) |
273 |
|
list = geasList.geasList (self, classdef) |
274 |
list.setPrefetch (["gnue_id"]) # + propertylist) TODO: fetch propertylist |
list.setPrefetch (["gnue_id"]) # + propertylist) TODO: fetch propertylist |
275 |
list.setSort (["gnue_id"]) |
list.setSort (["gnue_id"]) |
276 |
# Accessing the database for every single object_id is not very elegant, |
# Accessing the database for every single object_id is not very elegant, |