core: fixed cython compat inspect that caused some API calls to not work correctly.

This commit is contained in:
Marcin Kuzminski 2020-01-10 08:54:49 +01:00
parent d4e069aa94
commit 540f9ad582
4 changed files with 9 additions and 4 deletions

View file

@ -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)

View file

@ -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=Optional('*')):
]
error : null
"""
from rhodecode.config.patches import inspect_getargspec
inspect = inspect_getargspec()
if not has_superadmin_permission(apiuser):
raise JSONRPCForbidden()

View file

@ -95,3 +95,5 @@ def inspect_getargspec():
return inspect.ArgSpec(args, varargs, varkw, func.func_defaults)
inspect.getargspec = custom_getargspec
return inspect

View file

@ -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 '