diff --git a/rhodecode/api/__init__.py b/rhodecode/api/__init__.py --- a/rhodecode/api/__init__.py +++ b/rhodecode/api/__init__.py @@ -18,7 +18,6 @@ # RhodeCode Enterprise Edition, including its added features, Support services, # and proprietary license terms, please see https://rhodecode.com/licenses/ -import inspect import itertools import logging import sys @@ -186,10 +185,12 @@ def request_view(request): Main request handling method. It handles all logic to call a specific exposed method """ + # cython compatible inspect + from rhodecode.config.patches import inspect_getargspec + inspect = inspect_getargspec() # check if we can find this session using api_key, get_by_auth_token # search not expired tokens only - try: api_user = User.get_by_auth_token(request.rpc_api_key) diff --git a/rhodecode/api/views/server_api.py b/rhodecode/api/views/server_api.py --- a/rhodecode/api/views/server_api.py +++ b/rhodecode/api/views/server_api.py @@ -18,7 +18,6 @@ # RhodeCode Enterprise Edition, including its added features, Support services, # and proprietary license terms, please see https://rhodecode.com/licenses/ -import inspect import logging import itertools import base64 @@ -334,6 +333,9 @@ def get_method(request, apiuser, pattern ] error : null """ + from rhodecode.config.patches import inspect_getargspec + inspect = inspect_getargspec() + if not has_superadmin_permission(apiuser): raise JSONRPCForbidden() diff --git a/rhodecode/config/patches.py b/rhodecode/config/patches.py --- a/rhodecode/config/patches.py +++ b/rhodecode/config/patches.py @@ -95,3 +95,5 @@ def inspect_getargspec(): return inspect.ArgSpec(args, varargs, varkw, func.func_defaults) inspect.getargspec = custom_getargspec + + return inspect diff --git a/rhodecode/lib/auth.py b/rhodecode/lib/auth.py --- a/rhodecode/lib/auth.py +++ b/rhodecode/lib/auth.py @@ -24,7 +24,6 @@ authentication and permission libraries import os import time -import inspect import collections import fnmatch import hashlib @@ -2013,6 +2012,7 @@ class PermsFunction(object): self.user_group_name = None def __bool__(self): + import inspect frame = inspect.currentframe() stack_trace = traceback.format_stack(frame) log.error('Checking bool value on a class instance of perm '