Skip to content

Commit

Permalink
If tags is a string, use it as a single tag (#824)
Browse files Browse the repository at this point in the history
Signed-off-by: James Hewitt <[email protected]>
  • Loading branch information
Jamstah authored Jul 30, 2024
1 parent 3381f42 commit 792fc80
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ The format mostly follows [Keep a Changelog](http://keepachangelog.com/en/1.0.0/
- New `enabled` option for all jobs. Set to false to disable a job without needing to remove it or comment it out (Requested in #625 by snowman, contributed in #785 by jamstah)
- New option `ignore_incomplete_reads` (Requested in #725 by wschoot, contributed in #787 by wfrisch)
- New option `wait_for` in browser jobs (Requested in #763 by yuis-ice, contributed in #810 by jamstah)
- Added tags to jobs and the ability to select them at the command line (#789 by jamstah)
- Added tags to jobs and the ability to select them at the command line (#789, #824 by jamstah)

### Changed

Expand Down
2 changes: 1 addition & 1 deletion docs/source/jobs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ Optional keys for all job types
-------------------------------

- ``name``: Human-readable name/label of the job
- ``tags``: Array of tags
- ``tags``: Array of tags, or a single tag as a string
- ``filter``: :doc:`filters` (if any) to apply to the output (can be tested with ``--test-filter``)
- ``max_tries``: After this many sequential failed runs, the error will be reported rather than ignored
- ``diff_tool``: Command to a custom tool for generating diff text
Expand Down
4 changes: 3 additions & 1 deletion lib/urlwatch/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
import re
import subprocess
import textwrap
from typing import Iterable, Optional, Set, FrozenSet
from typing import Iterable, Optional, Set, FrozenSet, Sequence

import requests
from requests.packages.urllib3.exceptions import InsecureRequestWarning
Expand Down Expand Up @@ -220,6 +220,8 @@ def tags(self) -> Optional[FrozenSet[str]]:
def tags(self, value: Optional[Iterable[str]]):
if value is None:
self._tags = None
elif isinstance(value, str):
self._tags = frozenset([str])
else:
self._tags = frozenset(value)

Expand Down

0 comments on commit 792fc80

Please sign in to comment.