Browse Source

Bugfix & compatibility for webui

In this state I was able to insert a new site. But only the mongodb datasource
seems to have receive the query (inserted in DB but not created on FS).
Yann Weber 7 years ago
parent
commit
b5f9f97031

+ 9
- 9
lodel/plugins/webui/interface/controllers/admin.py View File

@@ -7,7 +7,7 @@ LodelContext.expose_modules(globals(), {
7 7
     'lodel.leapi.exceptions': [],
8 8
     'lodel.logger': 'logger',
9 9
     'lodel.leapi.datahandlers.base_classes': ['MultipleRef'],
10
-    'lodel.leapi.exceptions': ['LeApiDataCheckErrors'],
10
+    'lodel.leapi.exceptions': ['LeApiDataCheckErrors', 'LeApiError'],
11 11
     'lodel.exceptions': ['LodelExceptions']})
12 12
 LodelContext.expose_dyncode(globals(), 'dyncode')
13 13
 
@@ -43,7 +43,7 @@ def admin_update(request):
43 43
     if not(datas is False):
44 44
         if 'lodel_id' not in datas:
45 45
             raise HttpException(400)
46
-        target_leo = dyncode.Object.name2class(datas['classname'])
46
+        target_leo = dyncode.dynclasses[0].name2class(datas['classname'])
47 47
         leo = target_leo.get_from_uid(datas['lodel_id'])
48 48
         if leo is None:
49 49
             raise HttpException(404,
@@ -66,7 +66,7 @@ def admin_update(request):
66 66
             raise HttpException(400)
67 67
         classname = classname[0]
68 68
         try:
69
-            target_leo = dyncode.Object.name2class(classname)
69
+            target_leo = dyncode.dynclasses[0].name2class(classname)
70 70
         except LeApiError:
71 71
             # classname = None
72 72
             raise HttpException(400)
@@ -109,7 +109,7 @@ def admin_create(request):
109 109
 
110 110
     datas = process_form(request)
111 111
     if not(datas is False):
112
-        target_leo = dyncode.Object.name2class(datas['classname'])
112
+        target_leo = dyncode.dynclasses[0].name2class(datas['classname'])
113 113
         if 'lodel_id' in datas:
114 114
             raise HttpException(400)
115 115
         try:
@@ -158,7 +158,7 @@ def admin_delete(request):
158 158
             raise HttpException(400)
159 159
         classname = classname[0]
160 160
         try:
161
-            target_leo = dyncode.Object.name2class(classname)
161
+            target_leo = dyncode.dynclasses[0].name2class(classname)
162 162
         except LeApiError:
163 163
             # classname = None
164 164
             raise HttpException(400)
@@ -227,7 +227,7 @@ def admin_class(request):
227 227
             raise HttpException(400)
228 228
         classname = classname[0]
229 229
         try:
230
-            target_leo = dyncode.Object.name2class(classname)
230
+            target_leo = dyncode.dynclasses[0].name2class(classname)
231 231
         except LeApiError:
232 232
             classname = None
233 233
     if classname is None or target_leo.is_abstract():
@@ -246,7 +246,7 @@ def delete_in_class(request):
246 246
             raise HttpException(400)
247 247
         classname = classname[0]
248 248
         try:
249
-            target_leo = dyncode.Object.name2class(classname)
249
+            target_leo = dyncode.dynclasses[0].name2class(classname)
250 250
         except LeApiError:
251 251
             classname = None
252 252
     if classname is None or target_leo.is_abstract():
@@ -266,7 +266,7 @@ def search_object(request):
266 266
         classname = request.POST['classname']
267 267
         searchstring = request.POST['searchstring']
268 268
         try:
269
-            target_leo = dyncode.Object.name2class(classname)
269
+            target_leo = dyncode.dynclasses[0].name2class(classname)
270 270
         except LeApiError:
271 271
             raise HttpException(400)
272 272
         # TODO The get method must be implemented here
@@ -286,7 +286,7 @@ def process_form(request):
286 286
         raise HttpException(400)
287 287
     res['classname'] = classname = request.form['classname']
288 288
     try:
289
-        target_leo = dyncode.Object.name2class(classname)
289
+        target_leo = dyncode.dynclasses[0].name2class(classname)
290 290
     except LeApiError:
291 291
         logger.error(
292 292
             "Received a form with an invalid leo name : '%s'" % classname)

+ 2
- 1
lodel/plugins/webui/interface/controllers/listing.py View File

@@ -1,6 +1,7 @@
1 1
 # -*- coding: utf-8 -*-
2 2
 from lodel.context import LodelContext
3
-LodelContext.expose_modules(globals(), {'lodel.logger': 'logger'})
3
+LodelContext.expose_modules(globals(), {'lodel.logger': 'logger',
4
+    'lodel.leapi.exceptions': ['LeApiError']})
4 5
 LodelContext.expose_dyncode(globals(), 'dyncode')
5 6
 
6 7
 from .base import get_response

Loading…
Cancel
Save