Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved YAML group support #998

Merged
merged 3 commits into from
Nov 14, 2023
Merged

Improved YAML group support #998

merged 3 commits into from
Nov 14, 2023

Conversation

caronc
Copy link
Owner

@caronc caronc commented Nov 14, 2023

Description:

Related issue (if applicable): #952, and apprise-api/146

Current design of Tag Group handling works great as long as YAML definitions are in a list format only. e.g:

groups:
  - group1: tagB, tagC, tagNotAssigned
  - group2:
      - tagA
      - tagC
  - group3:
      - tagD: optional comment
      - tagA: optional comment #2

However the following is not supported (until this PR):

groups:
  group1: tagB, tagC, tagNotAssigned
  group2:
     - tagA
     - tagC
  group3:
     - tagD: optional comment
     - tagA: optional comment #2

It is worth noting that the trade-off (or perk, however you see it) with the new dict approach is that you can not stack entries and have them all append to one another. With the dict approach, the last defined entry prevails:

For example:

# duplicate group tags with the same name stack:
groups:
  - group: tagB, tagC
  - group: tagA

  # At this point, group == tagA, tagB and tagC

The new supported dict version behaves differently:

# duplicate group tags with the same name stack:
groups:
  group: tagB, tagC
  group: tagA

  # At this point, group == tagA (because it was the last entry defined and replaces
  # the previous value)

Checklist

  • The code change is tested and works locally.
  • There is no commented out code in this PR.
  • No lint errors (use flake8)
  • 100% test coverage

Testing

Anyone can help test this source code as follows:

# Create a virtual environment to work in as follows:
python3 -m venv apprise

# Change into our new directory
cd apprise

# Activate our virtual environment
source bin/activate

# Install the branch
pip install git+https://github.com/caronc/apprise.git@952-group-handling-fix

# Test out the changes with the following command:
apprise -t "Test Title" -b "Test Message" \
  <apprise url related to ticket>

@caronc caronc merged commit 0c5bd8a into master Nov 14, 2023
12 checks passed
@caronc caronc deleted the 952-group-handling-fix branch December 29, 2023 18:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant