From 6217ee7e04e2797b7057ffa2f28bbb383674567d Mon Sep 17 00:00:00 2001 From: 1maple1 <160027655+1maple1@users.noreply.github.com> Date: Thu, 12 Dec 2024 15:01:12 +0000 Subject: [PATCH 1/3] Update parameter support for filename --- CHANGELOG.rst | 1 + brewtils/models.py | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 5fa626ea..195c8162 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -5,6 +5,7 @@ Brewtils Changelog ------ TBD +- Update Parameter and Resolvable to add filename - Updated Wait Timeout Exception expected HTTP code from 408 to 504 - Dropping Official Python 2.7 Support diff --git a/brewtils/models.py b/brewtils/models.py index d0b967fa..841526f1 100644 --- a/brewtils/models.py +++ b/brewtils/models.py @@ -321,6 +321,7 @@ def __init__( self, key=None, type=None, # noqa # shadows built-in + filename=None, multi=None, display_name=None, optional=None, @@ -339,6 +340,7 @@ def __init__( ): self.key = key self.type = type + self.filename = filename self.multi = multi self.display_name = display_name self.optional = optional @@ -1690,11 +1692,13 @@ def __init__( self, id=None, # noqa # shadows built-in type=None, # noqa # shadows built-in + filename=None, storage=None, details=None, ): self.id = id self.type = type + self.filename = filename self.storage = storage self.details = details or {} From 2033cf9de375ddf9c2594976aba68666d52476a0 Mon Sep 17 00:00:00 2001 From: 1maple1 <160027655+1maple1@users.noreply.github.com> Date: Thu, 12 Dec 2024 18:46:25 +0000 Subject: [PATCH 2/3] Add filename to parameter and resolvable --- brewtils/decorators.py | 6 ++++++ brewtils/models.py | 4 ++-- brewtils/schemas.py | 2 ++ brewtils/test/fixtures.py | 3 +++ 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/brewtils/decorators.py b/brewtils/decorators.py index dde4da9a..9621437b 100644 --- a/brewtils/decorators.py +++ b/brewtils/decorators.py @@ -246,6 +246,7 @@ def parameter( display_name=None, # type: Optional[str] optional=None, # type: Optional[bool] default=None, # type: Optional[Any] + filename=None, # type: Optional[str] description=None, # type: Optional[str] choices=None, # type: Optional[Union[Callable, Dict, Iterable, str]] parameters=None, # type: Optional[List[Parameter]] @@ -284,6 +285,7 @@ def echo(self, message): optional: Boolean indicating if this parameter must be specified. default: The value this parameter will be assigned if not overridden when creating a request. + filename: Default string value for file input. description: An additional string that will be displayed in the user interface. choices: List or dictionary specifying allowed values. See documentation for more information. @@ -331,6 +333,7 @@ def echo(self, message): display_name=display_name, optional=optional, default=default, + filename=filename, description=description, choices=choices, parameters=parameters, @@ -351,6 +354,7 @@ def echo(self, message): display_name=display_name, optional=optional, default=default, + filename=filename, description=description, choices=choices, parameters=parameters, @@ -885,6 +889,7 @@ def _initialize_parameter( display_name=None, optional=None, default=None, + filename=None, description=None, choices=None, parameters=None, @@ -926,6 +931,7 @@ def _initialize_parameter( display_name=display_name, optional=optional, default=default, + filename=filename, description=description, choices=choices, parameters=parameters, diff --git a/brewtils/models.py b/brewtils/models.py index 841526f1..65fee0d3 100644 --- a/brewtils/models.py +++ b/brewtils/models.py @@ -321,11 +321,11 @@ def __init__( self, key=None, type=None, # noqa # shadows built-in - filename=None, multi=None, display_name=None, optional=None, default=None, + filename=None, description=None, choices=None, parameters=None, @@ -340,11 +340,11 @@ def __init__( ): self.key = key self.type = type - self.filename = filename self.multi = multi self.display_name = display_name self.optional = optional self.default = default + self.filename = filename self.description = description self.choices = choices self.parameters = parameters or [] diff --git a/brewtils/schemas.py b/brewtils/schemas.py index ccaeee87..645f6ca3 100644 --- a/brewtils/schemas.py +++ b/brewtils/schemas.py @@ -177,6 +177,7 @@ class ParameterSchema(BaseSchema): display_name = fields.Str(allow_none=True) optional = fields.Bool(allow_none=True) default = fields.Raw(allow_none=True) + filename = fields.Str(allow_none=True) description = fields.Str(allow_none=True) choices = fields.Nested("ChoicesSchema", allow_none=True, many=False) parameters = fields.Nested("self", many=True, allow_none=True) @@ -575,6 +576,7 @@ class ResolvableSchema(BaseSchema): type = fields.Str(allow_none=True) storage = fields.Str(allow_none=True) details = fields.Dict(allow_none=True) + filename = fields.Str(allow_none=True) class RoleSchema(BaseSchema): diff --git a/brewtils/test/fixtures.py b/brewtils/test/fixtures.py index 645fc4fe..dacfa86a 100644 --- a/brewtils/test/fixtures.py +++ b/brewtils/test/fixtures.py @@ -122,6 +122,7 @@ def nested_parameter_dict(): "display_name": "nested", "optional": True, "default": None, + "filename": None, "description": None, "choices": None, "parameters": [], @@ -144,6 +145,7 @@ def parameter_dict(nested_parameter_dict, choices_dict): "display_name": "display", "optional": True, "default": "default", + "filename": None, "description": "desc", "choices": choices_dict, "parameters": [nested_parameter_dict], @@ -1101,6 +1103,7 @@ def resolvable_dict(): "type": "bytes", "storage": "gridfs", "details": {"random": "detail"}, + "filename": None, } From 3852436a0c14cd4e41a2d4c2470918edc8b32b87 Mon Sep 17 00:00:00 2001 From: 1maple1 <160027655+1maple1@users.noreply.github.com> Date: Wed, 18 Dec 2024 13:24:03 +0000 Subject: [PATCH 3/3] Change filename to file_name --- CHANGELOG.rst | 2 +- brewtils/decorators.py | 12 ++++++------ brewtils/models.py | 8 ++++---- brewtils/schemas.py | 4 ++-- brewtils/test/fixtures.py | 6 +++--- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 195c8162..0e06ce5b 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -5,7 +5,7 @@ Brewtils Changelog ------ TBD -- Update Parameter and Resolvable to add filename +- Update Parameter and Resolvable to add file_name - Updated Wait Timeout Exception expected HTTP code from 408 to 504 - Dropping Official Python 2.7 Support diff --git a/brewtils/decorators.py b/brewtils/decorators.py index 9621437b..b4580b40 100644 --- a/brewtils/decorators.py +++ b/brewtils/decorators.py @@ -246,7 +246,7 @@ def parameter( display_name=None, # type: Optional[str] optional=None, # type: Optional[bool] default=None, # type: Optional[Any] - filename=None, # type: Optional[str] + file_name=None, # type: Optional[str] description=None, # type: Optional[str] choices=None, # type: Optional[Union[Callable, Dict, Iterable, str]] parameters=None, # type: Optional[List[Parameter]] @@ -285,7 +285,7 @@ def echo(self, message): optional: Boolean indicating if this parameter must be specified. default: The value this parameter will be assigned if not overridden when creating a request. - filename: Default string value for file input. + file_name: Default string value for file input. description: An additional string that will be displayed in the user interface. choices: List or dictionary specifying allowed values. See documentation for more information. @@ -333,7 +333,7 @@ def echo(self, message): display_name=display_name, optional=optional, default=default, - filename=filename, + file_name=file_name, description=description, choices=choices, parameters=parameters, @@ -354,7 +354,7 @@ def echo(self, message): display_name=display_name, optional=optional, default=default, - filename=filename, + file_name=file_name, description=description, choices=choices, parameters=parameters, @@ -889,7 +889,7 @@ def _initialize_parameter( display_name=None, optional=None, default=None, - filename=None, + file_name=None, description=None, choices=None, parameters=None, @@ -931,7 +931,7 @@ def _initialize_parameter( display_name=display_name, optional=optional, default=default, - filename=filename, + file_name=file_name, description=description, choices=choices, parameters=parameters, diff --git a/brewtils/models.py b/brewtils/models.py index 65fee0d3..8a7640bb 100644 --- a/brewtils/models.py +++ b/brewtils/models.py @@ -325,7 +325,7 @@ def __init__( display_name=None, optional=None, default=None, - filename=None, + file_name=None, description=None, choices=None, parameters=None, @@ -344,7 +344,7 @@ def __init__( self.display_name = display_name self.optional = optional self.default = default - self.filename = filename + self.file_name = file_name self.description = description self.choices = choices self.parameters = parameters or [] @@ -1692,13 +1692,13 @@ def __init__( self, id=None, # noqa # shadows built-in type=None, # noqa # shadows built-in - filename=None, + file_name=None, storage=None, details=None, ): self.id = id self.type = type - self.filename = filename + self.file_name = file_name self.storage = storage self.details = details or {} diff --git a/brewtils/schemas.py b/brewtils/schemas.py index 645f6ca3..edcca18e 100644 --- a/brewtils/schemas.py +++ b/brewtils/schemas.py @@ -177,7 +177,7 @@ class ParameterSchema(BaseSchema): display_name = fields.Str(allow_none=True) optional = fields.Bool(allow_none=True) default = fields.Raw(allow_none=True) - filename = fields.Str(allow_none=True) + file_name = fields.Str(allow_none=True) description = fields.Str(allow_none=True) choices = fields.Nested("ChoicesSchema", allow_none=True, many=False) parameters = fields.Nested("self", many=True, allow_none=True) @@ -576,7 +576,7 @@ class ResolvableSchema(BaseSchema): type = fields.Str(allow_none=True) storage = fields.Str(allow_none=True) details = fields.Dict(allow_none=True) - filename = fields.Str(allow_none=True) + file_name = fields.Str(allow_none=True) class RoleSchema(BaseSchema): diff --git a/brewtils/test/fixtures.py b/brewtils/test/fixtures.py index dacfa86a..e57c5be8 100644 --- a/brewtils/test/fixtures.py +++ b/brewtils/test/fixtures.py @@ -122,7 +122,7 @@ def nested_parameter_dict(): "display_name": "nested", "optional": True, "default": None, - "filename": None, + "file_name": None, "description": None, "choices": None, "parameters": [], @@ -145,7 +145,7 @@ def parameter_dict(nested_parameter_dict, choices_dict): "display_name": "display", "optional": True, "default": "default", - "filename": None, + "file_name": None, "description": "desc", "choices": choices_dict, "parameters": [nested_parameter_dict], @@ -1103,7 +1103,7 @@ def resolvable_dict(): "type": "bytes", "storage": "gridfs", "details": {"random": "detail"}, - "filename": None, + "file_name": None, }