Conditional Lazy Listener?
@seratch đang làm issue này rồi.
Từ ngày 4/10/2021.
Đánh giá
Issue này chưa được đánh giá.
Mô tả
Is there a way to make it so that the lazy function triggers conditionally based on the ack response?
For example, I want my ack to do parameter validation and potentially reject the request. Right now, my solution is to have the lazy function run the same parameter validation as the ack function, but it seems a bit wasteful. I'd much rather the lazy function not get triggered at all in the scenario where the ack function returns errors to the user.
Reproducible in:
The slack_bolt version
slack-bolt==1.9.1
Python runtime version
Python 3.8.12
OS info
ProductName: macOS
ProductVersion: 11.5.2
BuildVersion: 20G95
Darwin Kernel Version 20.6.0: Wed Jun 23 00:26:31 PDT 2021; root:xnu-7195.141.2~5/RELEASE_X86_64
Steps to reproduce:
Run something like this:
def validate_the_stuff(ack, view):
#errors = validate_inputs(view)
errors = { "environment-select-block": "Nope" }
if len(errors) > 0:
ack(response_action="errors", errors=errors)
return False
else:
ack(response_action="clear")
def do_the_thing(view):
logging.error("You should not get this far")
app.view_submission('environment_select_submit')(
ack=validate_the_stuff,
lazy=[do_the_thing]
)
Expected result:
Don't do the thing if validation fails.
Actual result:
Does the thing even if validation fails.
Requirements
Please read the Contributing guidelines and Code of Conduct before creating this issue or pull request. By submitting, you are agreeing to those rules.
- Ngôn ngữ chính
- Python
- Star
- 1.3k
- Fork
- 288
- Merge trung bình
- 1 ngày 8 giờ
- Pull request đã merge (30 ngày)
- 10
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của slackapi/bolt-python
-
docs enhancement server-side
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
slackapi/bolt-python#1576 · 1 bình luận ·
-
auto-triage-skip bug security semver:major
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
slackapi/bolt-python#1447 · 9 bình luận ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 65/100
slackapi/bolt-python#1577 ·
-
area:async auto-triage-skip dependencies
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 65/100
slackapi/bolt-python#1472 · 1 bình luận · 1 reaction ·
-
auto-triage-skip enhancement
slackapi/bolt-python#1346 · 2 bình luận · 1 người được giao ·
Tất cả issue của slackapi/bolt-python
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
PolicyEngine/policyengine-us#9559 ·
-
priority: p3
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
googleapis/librarian#7636 ·
-
from:qa priority:P2 reliability tech-debt
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
spec-kitty/spec-kitty#4874 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100