in chalice/app.py [0:0]
def _do_register_handler(self, handler_type: str, name: str,
user_handler: UserHandlerFuncType,
wrapped_handler: Callable[..., Any], kwargs: Any,
options: Optional[Dict[Any, Any]] = None) -> None:
module_name = 'app'
if options is not None:
name_prefix = options.get('name_prefix')
if name_prefix is not None:
name = name_prefix + name
url_prefix = options.get('url_prefix')
if url_prefix is not None and handler_type == 'route':
# Move url_prefix into kwargs so only the
# route() handler gets a url_prefix kwarg.
kwargs['url_prefix'] = url_prefix
# module_name is always provided if options is not None.
module_name = options['module_name']
handler_string = '%s.%s' % (module_name, user_handler.__name__)
getattr(self, '_register_%s' % handler_type)(
name=name,
user_handler=user_handler,
handler_string=handler_string,
wrapped_handler=wrapped_handler,
kwargs=kwargs,
)
self.handler_map[name] = wrapped_handler