From 5db21416142bf18580023814954544e1b140f275 Mon Sep 17 00:00:00 2001 From: Shawn Davis Date: Tue, 26 Jan 2021 12:10:43 -0500 Subject: [PATCH] Modified command filtering to always allow empty command environments and updated ItemizedCommand to include empty envrionments and tags attributes by default. --- VERSION.txt | 2 +- scripttease/library/commands/base.py | 5 +++++ scripttease/parsers/utils.py | 2 +- scripttease/version.py | 6 +++--- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/VERSION.txt b/VERSION.txt index 23863d3..295ec49 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -6.8.1 \ No newline at end of file +6.8.2 \ No newline at end of file diff --git a/scripttease/library/commands/base.py b/scripttease/library/commands/base.py index 5af1c4f..0abb978 100644 --- a/scripttease/library/commands/base.py +++ b/scripttease/library/commands/base.py @@ -198,6 +198,11 @@ class ItemizedCommand(object): self.kwargs = kwargs self.name = name + # Set defaults for when ItemizedCommand is referenced directly before individual commands are instantiated. For + # example, when command filtering occurs. + self.kwargs.setdefault("environments", list()) + self.kwargs.setdefault("tags", list()) + def __getattr__(self, item): return self.kwargs.get(item) diff --git a/scripttease/parsers/utils.py b/scripttease/parsers/utils.py index 678365f..a967a30 100644 --- a/scripttease/parsers/utils.py +++ b/scripttease/parsers/utils.py @@ -38,7 +38,7 @@ def filter_commands(commands, environments=None, tags=None): """ filtered = list() for command in commands: - if environments is not None: + if environments is not None and len(command.environments) > 0: if not any_list_item(environments, command.environments): continue diff --git a/scripttease/version.py b/scripttease/version.py index 771da44..e8a2fdc 100644 --- a/scripttease/version.py +++ b/scripttease/version.py @@ -1,5 +1,5 @@ -DATE = "2021-01-01" -VERSION = "6.8.1" +DATE = "2021-01-26" +VERSION = "6.8.2" MAJOR = 6 MINOR = 8 -PATCH = 1 +PATCH = 2