Show More
@@ -256,7 +256,7 b' def request_view(request):' | |||||
256 | except JSONRPCBaseError: |
|
256 | except JSONRPCBaseError: | |
257 | raise |
|
257 | raise | |
258 | except Exception: |
|
258 | except Exception: | |
259 | log.exception('Unhandled exception occured on api call: %s', func) |
|
259 | log.exception('Unhandled exception occurred on api call: %s', func) | |
260 | return jsonrpc_error(request, retid=request.rpc_id, |
|
260 | return jsonrpc_error(request, retid=request.rpc_id, | |
261 | message='Internal server error') |
|
261 | message='Internal server error') | |
262 |
|
262 |
@@ -76,6 +76,18 b' class RhodecodeCeleryTask(Task):' | |||||
76 |
|
76 | |||
77 | request = get_current_request() |
|
77 | request = get_current_request() | |
78 |
|
78 | |||
|
79 | if hasattr(request, 'user'): | |||
|
80 | ip_addr = request.user.ip_addr | |||
|
81 | user_id = request.user.user_id | |||
|
82 | elif hasattr(request, 'rpc_params'): | |||
|
83 | # TODO(marcink) remove when migration is finished | |||
|
84 | # api specific call on Pyramid. | |||
|
85 | ip_addr = request.rpc_params['apiuser'].ip_addr | |||
|
86 | user_id = request.rpc_params['apiuser'].user_id | |||
|
87 | else: | |||
|
88 | raise Exception('Unable to fetch data from request: {}'.format( | |||
|
89 | request)) | |||
|
90 | ||||
79 | if request: |
|
91 | if request: | |
80 | # we hook into kwargs since it is the only way to pass our data to |
|
92 | # we hook into kwargs since it is the only way to pass our data to | |
81 | # the celery worker in celery 2.2 |
|
93 | # the celery worker in celery 2.2 | |
@@ -91,8 +103,8 b' class RhodecodeCeleryTask(Task):' | |||||
91 | 'wsgi.url_scheme': request.environ['wsgi.url_scheme'], |
|
103 | 'wsgi.url_scheme': request.environ['wsgi.url_scheme'], | |
92 | }, |
|
104 | }, | |
93 | 'auth_user': { |
|
105 | 'auth_user': { | |
94 |
'ip_addr': |
|
106 | 'ip_addr': ip_addr, | |
95 |
'user_id': |
|
107 | 'user_id': user_id | |
96 | }, |
|
108 | }, | |
97 | } |
|
109 | } | |
98 | }) |
|
110 | }) |
General Comments 0
You need to be logged in to leave comments.
Login now