Refactor how parsed_args are passed to methods
This commit is contained in:
parent
daab1b3964
commit
018bf8c5ad
13 changed files with 142 additions and 137 deletions
|
@ -75,14 +75,14 @@ class UserRobotList(ApiResource):
|
|||
""" Resource for listing user robots. """
|
||||
@require_user_admin
|
||||
@nickname('getUserRobots')
|
||||
@parse_args
|
||||
@parse_args()
|
||||
@query_param('permissions',
|
||||
'Whether to include repostories and teams in which the robots have permission.',
|
||||
type=truthy_bool, default=False)
|
||||
def get(self, args):
|
||||
def get(self, parsed_args):
|
||||
""" List the available robots for the user. """
|
||||
user = get_authenticated_user()
|
||||
return robots_list(user.username, include_permissions=args.get('permissions', False))
|
||||
return robots_list(user.username, include_permissions=parsed_args.get('permissions', False))
|
||||
|
||||
|
||||
@resource('/v1/user/robots/<robot_shortname>')
|
||||
|
@ -124,15 +124,15 @@ class OrgRobotList(ApiResource):
|
|||
""" Resource for listing an organization's robots. """
|
||||
@require_scope(scopes.ORG_ADMIN)
|
||||
@nickname('getOrgRobots')
|
||||
@parse_args
|
||||
@parse_args()
|
||||
@query_param('permissions',
|
||||
'Whether to include repostories and teams in which the robots have permission.',
|
||||
type=truthy_bool, default=False)
|
||||
def get(self, args, orgname):
|
||||
def get(self, orgname, parsed_args):
|
||||
""" List the organization's robots. """
|
||||
permission = OrganizationMemberPermission(orgname)
|
||||
if permission.can():
|
||||
return robots_list(orgname, include_permissions=args.get('permissions', False))
|
||||
return robots_list(orgname, include_permissions=parsed_args.get('permissions', False))
|
||||
|
||||
raise Unauthorized()
|
||||
|
||||
|
|
Reference in a new issue