示例#1
0
def check_args(annotation, args):
    for key, val in args.items():
        type=annotation.get(key)
        try:
            check_type(args, key, type)
        except ValueError as e:
            raise AssertionError(_('Incorrect parameters')+": \n%s" % (e))
    for key in annotation:
        if not key in args:
            args[key]=None
示例#2
0
文件: api.py 项目: kreopt/pyapi
 def decorated(self, *args, **kwargs):
     if self.is_role(role):
         return method(self, *args, **kwargs)
     else:
         raise ApiCallAccess(_('Access denied'))
示例#3
0
文件: api.py 项目: kreopt/pyapi
 def decorated(self, *args, **kwargs):
     if self.has_permission(permission):
         return method(self, *args, **kwargs)
     else:
         raise ApiCallAccess(_('Access denied'))