##// END OF EJS Templates
hooks: use safer way to validate kwargs. If rcextensions are disable we shouldn't...
marcink -
r3220:f879e54e default
parent child Browse files
Show More
@@ -339,7 +339,12 b' class ExtensionCallback(object):'
339 339 self._kwargs_keys = set(kwargs_keys)
340 340
341 341 def __call__(self, *args, **kwargs):
342 log.debug('Calling extension callback for %s', self._hook_name)
342 log.debug('Calling extension callback for `%s`', self._hook_name)
343 callback = self._get_callback()
344 if not callback:
345 log.debug('extension callback `%s` not found, skipping...', self._hook_name)
346 return
347
343 348 kwargs_to_pass = {}
344 349 for key in self._kwargs_keys:
345 350 try:
@@ -349,16 +354,11 b' class ExtensionCallback(object):'
349 354 key, self._kwargs_keys)
350 355 raise
351 356
352 # backward compat for removed api_key for old hooks. THis was it works
357 # backward compat for removed api_key for old hooks. This was it works
353 358 # with older rcextensions that require api_key present
354 359 if self._hook_name in ['CREATE_USER_HOOK', 'DELETE_USER_HOOK']:
355 360 kwargs_to_pass['api_key'] = '_DEPRECATED_'
356
357 callback = self._get_callback()
358 if callback:
359 361 return callback(**kwargs_to_pass)
360 else:
361 log.debug('extensions callback not found skipping...')
362 362
363 363 def is_active(self):
364 364 return hasattr(rhodecode.EXTENSIONS, self._hook_name)
General Comments 0
You need to be logged in to leave comments. Login now