Skip to content

Add Default of None for selected_options for ViewStateValue #987

Description

Having a default of None will allow for consistency within the ViewStateValue object. All other attributes default to None, but selected_options does not get set if the input is an empty list (ex Checkbox). This results in an AttributeError.

Reproducible in:

The Slack SDK version

slack-bolt==1.4.4

Python runtime version

Python 3.8.3

OS info

OS info
ProductName:	Mac OS X
ProductVersion:	10.15.7
BuildVersion:	19H524
Darwin Kernel Version 19.6.0: Tue Jan 12 22:13:05 PST 2021; root:xnu-6153.141.16~1/RELEASE_X86_64

Steps to reproduce:

(Share the commands to run, source code, and project settings (e.g., setup.py))

  1. Instantiate a ViewStateValue with selected_options as an empty list
  2. See below

Expected result:

selected_options should default to None

Actual result:

>>> d = {"selected_options": []}
>>> v = ViewStateValue(**d)
>>> v
<slack_sdk.ViewStateValue>
>>> v.selected_channel is None
True
>>> v.selected_options is None
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'ViewStateValue' object has no attribute 'selected_options'

Requirements

For general questions/issues about Slack API platform or its server-side, could you submit questions at https://my.slack.com/help/requests/new instead. 🙇

Please read the Contributing guidelines and Code of Conduct before creating this issue or pull request. By submitting, you are agreeing to those rules.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions