Skip to content

Allow "warning" type protected ranges - #1439

Merged
alifeee merged 6 commits into
masterfrom
fix/protected-range-warnings
Mar 17, 2024
Merged

alifeee merged 6 commits into
masterfrom
fix/protected-range-warnings

Conversation

@alifeee

@alifeee alifeee commented Mar 15, 2024

Copy link
Copy Markdown
Collaborator

closes #1437

They were not allowed before because:

It seems that when add_protected_range was added it was assumed that editor_users_emails was always required. However, warning ranges do not require (and in fact, cannot contain) emails.

To fix this issue, we:

  • change editor_users_emails from and argument to a keyword argument (if it is not changed in position, it should still be usable as an argument)
  • add some logic in the code to not pass "editors" if warning_only is set

@lavigne958 lavigne958 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great change ! Oddly enough the API allows a user to set a protected range with no editors (when providing an actual empty list of editors). 🤔

@alifeee

alifeee commented Mar 16, 2024

Copy link
Copy Markdown
Collaborator Author

yes I wasn't sure what email to put in the test, since it would be different for whoever ran the test.

maybe the email is fetchable from an API somewhere?

@lavigne958

Copy link
Copy Markdown
Collaborator

yes I wasn't sure what email to put in the test, since it would be different for whoever ran the test.

maybe the email is fetchable from an API somewhere?

I don't think it's a problem. Leaving it like this endures it works with no emails too 🙄

@alifeee
alifeee merged commit 3e5ca62 into master Mar 17, 2024
@alifeee
alifeee deleted the fix/protected-range-warnings branch March 17, 2024 17:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

worksheet.add_protected_range() - impossible to create the warning_only=True range

2 participants