Skip to content

Commit d1ff139

Browse files
committed
fix DISALLOW and NECESSARY get wrongly problem
1 parent d1576ac commit d1ff139

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

uliweb_apijson/apijson/views.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -380,9 +380,9 @@ def _post_one(self,key,tag):
380380
params_role = ADD_role
381381

382382
permission_check_ok = False
383-
POST = model_setting.get("POST")
384-
if POST:
385-
roles = POST.get("roles")
383+
model_POST = model_setting.get("POST")
384+
if model_POST:
385+
roles = model_POST.get("roles")
386386
if params_role:
387387
if not params_role in roles:
388388
return json({"code":400,"msg":"'%s' not accessible by role '%s'"%(modelname,params_role)})
@@ -409,17 +409,17 @@ def _post_one(self,key,tag):
409409
if not permission_check_ok:
410410
return json({"code":400,"msg":"no permission"})
411411

412-
DISALLOW = POST.get("DISALLOW")
412+
DISALLOW = tag_POST.get("DISALLOW")
413413
if DISALLOW:
414414
for field in DISALLOW:
415415
if field in params:
416416
log.error("request '%s' disallow '%s'"%(tag,field))
417417
return json({"code":400,"msg":"request '%s' disallow '%s'"%(tag,field)})
418418

419-
NECESSARY = POST.get("NECESSARY")
419+
NECESSARY = tag_POST.get("NECESSARY")
420420
if NECESSARY:
421421
for field in NECESSARY:
422-
if field not in params:
422+
if field not in params or params.get(field)==None:
423423
log.error("request '%s' don't have necessary field '%s'"%(tag,field))
424424
return json({"code":400,"msg":"request '%s' don't have necessary field '%s'"%(tag,field)})
425425

0 commit comments

Comments
 (0)