##// END OF EJS Templates
code: added more logging, and some notes
marcink -
r1300:0ec329be default
parent child Browse files
Show More
@@ -132,7 +132,7 b' def exception_view(exc, request):'
132 132 log.debug('json-rpc error rpc_id:%s "%s"', rpc_id, fault_message)
133 133 elif isinstance(exc, JSONRPCValidationError):
134 134 colander_exc = exc.colander_exception
135 #TODO: think maybe of nicer way to serialize errors ?
135 # TODO(marcink): think maybe of nicer way to serialize errors ?
136 136 fault_message = colander_exc.asdict()
137 137 log.debug('json-rpc error rpc_id:%s "%s"', rpc_id, fault_message)
138 138 elif isinstance(exc, JSONRPCForbidden):
@@ -240,7 +240,7 b' def request_view(request):'
240 240 message=('Missing non optional `%s` arg in JSON DATA' % arg)
241 241 )
242 242
243 # sanitze extra passed arguments
243 # sanitize extra passed arguments
244 244 for k in request.rpc_params.keys()[:]:
245 245 if k not in func_kwargs:
246 246 del request.rpc_params[k]
@@ -269,9 +269,10 b' def setup_request(request):'
269 269 We need to raise JSONRPCError here if we want to return some errors back to
270 270 user.
271 271 """
272
272 273 log.debug('Executing setup request: %r', request)
273 274 request.rpc_ip_addr = get_ip_addr(request.environ)
274 # TODO: marcink, deprecate GET at some point
275 # TODO(marcink): deprecate GET at some point
275 276 if request.method not in ['POST', 'GET']:
276 277 log.debug('unsupported request method "%s"', request.method)
277 278 raise JSONRPCError(
@@ -308,6 +309,8 b' def setup_request(request):'
308 309 if not api_key:
309 310 raise KeyError('api_key or auth_token')
310 311
312 # TODO(marcink): support passing in token in request header
313
311 314 request.rpc_api_key = api_key
312 315 request.rpc_id = json_body['id']
313 316 request.rpc_method = json_body['method']
@@ -485,8 +488,7 b' def includeme(config):'
485 488 config.registry.jsonrpc_methods = OrderedDict()
486 489
487 490 # match filter by given method only
488 config.add_view_predicate(
489 'jsonrpc_method', MethodPredicate)
491 config.add_view_predicate('jsonrpc_method', MethodPredicate)
490 492
491 493 config.add_renderer(DEFAULT_RENDERER, ExtJsonRenderer(
492 494 serializer=json.dumps, indent=4))
@@ -846,7 +846,7 b' class AuthUser(object):'
846 846 Fills in user data and propagates values to this instance. Maps fetched
847 847 user attributes to this class instance attributes
848 848 """
849
849 log.debug('starting data propagation for new potential AuthUser')
850 850 user_model = UserModel()
851 851 anon_user = self.anonymous_user = User.get_default_user(cache=True)
852 852 is_user_loaded = False
@@ -393,7 +393,8 b' def get_auth_user(environ):'
393 393 request.GET.get('api_key', ''))
394 394
395 395 if _auth_token:
396 # when using API_KEY we are sure user exists.
396 # when using API_KEY we assume user exists, and
397 # doesn't need auth based on cookies.
397 398 auth_user = AuthUser(api_key=_auth_token, ip_addr=ip_addr)
398 399 authenticated = False
399 400 else:
@@ -412,8 +413,7 b' def get_auth_user(environ):'
412 413
413 414 if password_changed(auth_user, session):
414 415 session.invalidate()
415 cookie_store = CookieStoreWrapper(
416 session.get('rhodecode_user'))
416 cookie_store = CookieStoreWrapper(session.get('rhodecode_user'))
417 417 auth_user = AuthUser(ip_addr=ip_addr)
418 418
419 419 authenticated = cookie_store.get('is_authenticated')
@@ -52,9 +52,11 b' def pylons_compatibility_tween_factory(h'
52 52 request.environ, request.registry.settings.get('vcs.backends'))
53 53
54 54 if vcs_handler:
55 # save detected VCS type for later re-use
55 56 request.environ[VCS_TYPE_KEY] = vcs_handler.SCM
56 57 return handler(request)
57 58
59 # mark that we didn't detect an VCS, and we can skip detection later on
58 60 request.environ[VCS_TYPE_KEY] = VCS_TYPE_SKIP
59 61
60 62 # Setup pylons globals.
General Comments 0
You need to be logged in to leave comments. Login now