diff --git a/docs/api-docs/slack_bolt/adapter/pyramid/handler.html b/docs/api-docs/slack_bolt/adapter/pyramid/handler.html
index 44b8ee923..90c065277 100644
--- a/docs/api-docs/slack_bolt/adapter/pyramid/handler.html
+++ b/docs/api-docs/slack_bolt/adapter/pyramid/handler.html
@@ -73,17 +73,37 @@
Module slack_bolt.adapter.pyramid.handler
if self.app.oauth_flow is not None:
oauth_flow: OAuthFlow = self.app.oauth_flow
if request.path == oauth_flow.install_path:
- bolt_resp = oauth_flow.handle_installation(to_bolt_request(request))
+ bolt_req = _attach_pyramid_request_to_context(to_bolt_request(request), request)
+ bolt_resp = oauth_flow.handle_installation(bolt_req)
return to_pyramid_response(bolt_resp)
elif request.path == oauth_flow.redirect_uri_path:
- bolt_resp = oauth_flow.handle_callback(to_bolt_request(request))
+ bolt_req = _attach_pyramid_request_to_context(to_bolt_request(request), request)
+ bolt_resp = oauth_flow.handle_callback(bolt_req)
return to_pyramid_response(bolt_resp)
elif request.method == "POST":
- bolt_req = to_bolt_request(request)
+ bolt_req = _attach_pyramid_request_to_context(to_bolt_request(request), request)
bolt_resp = self.app.dispatch(bolt_req)
return to_pyramid_response(bolt_resp)
- return Response(status=404, body="Not found")
+ return Response(status=404, body="Not found")
+
+
+def _attach_pyramid_request_to_context(
+ bolt_req: BoltRequest,
+ request: Request,
+) -> BoltRequest:
+ # To enable developers to access request-scope attributes such as dbsession,
+ # this adapter exposes the underlying pyramid_request object to Bolt listeners
+ #
+ # Developers can access request props this way:
+ # @app.event("app_mention")
+ # def handle_app_mention_events(context, logger):
+ # req = context["pyramid_request"]
+ # all = req.dbsession.query(MyModel).all()
+ # logger.info(all)
+ #
+ bolt_req.context["pyramid_request"] = request
+ return bolt_req
@@ -164,13 +184,15 @@
if self.app.oauth_flow is not None:
oauth_flow: OAuthFlow = self.app.oauth_flow
if request.path == oauth_flow.install_path:
- bolt_resp = oauth_flow.handle_installation(to_bolt_request(request))
+ bolt_req = _attach_pyramid_request_to_context(to_bolt_request(request), request)
+ bolt_resp = oauth_flow.handle_installation(bolt_req)
return to_pyramid_response(bolt_resp)
elif request.path == oauth_flow.redirect_uri_path:
- bolt_resp = oauth_flow.handle_callback(to_bolt_request(request))
+ bolt_req = _attach_pyramid_request_to_context(to_bolt_request(request), request)
+ bolt_resp = oauth_flow.handle_callback(bolt_req)
return to_pyramid_response(bolt_resp)
elif request.method == "POST":
- bolt_req = to_bolt_request(request)
+ bolt_req = _attach_pyramid_request_to_context(to_bolt_request(request), request)
bolt_resp = self.app.dispatch(bolt_req)
return to_pyramid_response(bolt_resp)
@@ -192,13 +214,15 @@ Methods
if self.app.oauth_flow is not None:
oauth_flow: OAuthFlow = self.app.oauth_flow
if request.path == oauth_flow.install_path:
- bolt_resp = oauth_flow.handle_installation(to_bolt_request(request))
+ bolt_req = _attach_pyramid_request_to_context(to_bolt_request(request), request)
+ bolt_resp = oauth_flow.handle_installation(bolt_req)
return to_pyramid_response(bolt_resp)
elif request.path == oauth_flow.redirect_uri_path:
- bolt_resp = oauth_flow.handle_callback(to_bolt_request(request))
+ bolt_req = _attach_pyramid_request_to_context(to_bolt_request(request), request)
+ bolt_resp = oauth_flow.handle_callback(bolt_req)
return to_pyramid_response(bolt_resp)
elif request.method == "POST":
- bolt_req = to_bolt_request(request)
+ bolt_req = _attach_pyramid_request_to_context(to_bolt_request(request), request)
bolt_resp = self.app.dispatch(bolt_req)
return to_pyramid_response(bolt_resp)
diff --git a/docs/api-docs/slack_bolt/adapter/pyramid/index.html b/docs/api-docs/slack_bolt/adapter/pyramid/index.html
index 368a48f9c..81a32f9bb 100644
--- a/docs/api-docs/slack_bolt/adapter/pyramid/index.html
+++ b/docs/api-docs/slack_bolt/adapter/pyramid/index.html
@@ -68,13 +68,15 @@
if self.app.oauth_flow is not None:
oauth_flow: OAuthFlow = self.app.oauth_flow
if request.path == oauth_flow.install_path:
- bolt_resp = oauth_flow.handle_installation(to_bolt_request(request))
+ bolt_req = _attach_pyramid_request_to_context(to_bolt_request(request), request)
+ bolt_resp = oauth_flow.handle_installation(bolt_req)
return to_pyramid_response(bolt_resp)
elif request.path == oauth_flow.redirect_uri_path:
- bolt_resp = oauth_flow.handle_callback(to_bolt_request(request))
+ bolt_req = _attach_pyramid_request_to_context(to_bolt_request(request), request)
+ bolt_resp = oauth_flow.handle_callback(bolt_req)
return to_pyramid_response(bolt_resp)
elif request.method == "POST":
- bolt_req = to_bolt_request(request)
+ bolt_req = _attach_pyramid_request_to_context(to_bolt_request(request), request)
bolt_resp = self.app.dispatch(bolt_req)
return to_pyramid_response(bolt_resp)
@@ -96,13 +98,15 @@ Methods
if self.app.oauth_flow is not None:
oauth_flow: OAuthFlow = self.app.oauth_flow
if request.path == oauth_flow.install_path:
- bolt_resp = oauth_flow.handle_installation(to_bolt_request(request))
+ bolt_req = _attach_pyramid_request_to_context(to_bolt_request(request), request)
+ bolt_resp = oauth_flow.handle_installation(bolt_req)
return to_pyramid_response(bolt_resp)
elif request.path == oauth_flow.redirect_uri_path:
- bolt_resp = oauth_flow.handle_callback(to_bolt_request(request))
+ bolt_req = _attach_pyramid_request_to_context(to_bolt_request(request), request)
+ bolt_resp = oauth_flow.handle_callback(bolt_req)
return to_pyramid_response(bolt_resp)
elif request.method == "POST":
- bolt_req = to_bolt_request(request)
+ bolt_req = _attach_pyramid_request_to_context(to_bolt_request(request), request)
bolt_resp = self.app.dispatch(bolt_req)
return to_pyramid_response(bolt_resp)
diff --git a/docs/api-docs/slack_bolt/middleware/middleware_error_handler.html b/docs/api-docs/slack_bolt/middleware/middleware_error_handler.html
index 03c51e1e3..e8d65d50d 100644
--- a/docs/api-docs/slack_bolt/middleware/middleware_error_handler.html
+++ b/docs/api-docs/slack_bolt/middleware/middleware_error_handler.html
@@ -91,7 +91,7 @@ Module slack_bolt.middleware.middleware_error_handler
@@ -173,7 +173,7 @@ Inherited members
request: BoltRequest,
response: Optional[BoltResponse],
):
- message = f"Failed to run a middleware middleware (error: {error})"
+ message = f"Failed to run a middleware (error: {error})"
self.logger.exception(message)
Ancestors
diff --git a/docs/api-docs/slack_bolt/version.html b/docs/api-docs/slack_bolt/version.html
index 35056bd7e..ebed668c7 100644
--- a/docs/api-docs/slack_bolt/version.html
+++ b/docs/api-docs/slack_bolt/version.html
@@ -28,7 +28,7 @@ Module slack_bolt.version
Expand source code
"""Check the latest version at https://pypi.org/project/slack-bolt/"""
-__version__ = "1.16.0"
+__version__ = "1.16.1"
diff --git a/slack_bolt/version.py b/slack_bolt/version.py
index caf8ffb71..6dd0d6d25 100644
--- a/slack_bolt/version.py
+++ b/slack_bolt/version.py
@@ -1,2 +1,2 @@
"""Check the latest version at https://pypi.org/project/slack-bolt/"""
-__version__ = "1.16.0"
+__version__ = "1.16.1"