PackageParametersDefinition

class PackageParametersDefinition

Returned by

AppendParameter(name, value=None, description=None)

Appends a new package parameter. If a parameter with the same name already exists, it will be overwritten.

Parameters:
name : str

Name of the parameter

value : string

Value of the parameter as you would type it in the dialog (i.e. for strings you need to include the quotes!)

description : str

Description of the parameter

Raises:

ApiError – If parameter with the given name (and value/description) could not be appended, e.g. if the value or description are invalid.

Clone()

Call this method if you want to use API-objects in multiple contexts, e.g. if you want to insert a specific test step in multiple blocks.

Returns:

A copy of this object

Return type:

PackageParametersDefinition

GetAllParameterNames()

Returns a list of all parameterized package parameter names.

Returns:

List of all parameterized parameter names

Return type:

list[str]

GetDescription(name)

Returns the description of the parameter specified by the given name.

Parameters:
name : str

Name of the parameter to get the description of

Returns:

The desription of the parameter

Return type:

str

GetFilename()

Returns the file name of the package parameters definition file, if this is a file. Returns None if this is part of a parameter set or an unsaved file.

Returns:

The file name of the saved file or None, if not a file

Return type:

str

GetValue(name)

Returns the value of the given parameter. If the value of an existing parameter is empty it will return None, if the value is defined as None it will return ‘None’.

Parameters:
name : str

Name of the parameter to get the value of

Returns:

Value of the given parameter

Return type:

str

Raises:

ApiError – If the parameter with the given name does not exist

RemoveParameter(name)

Removes the parameter specified by the given name.

Parameters:
name : str

Name of the parameter to remove

Returns:

If removing of the given parameter was successful

Return type:

boolean

Save(filename=None, allowCompatibilityFallback=False)

Saves the package parameters definition to a file. Appends file ending if needed.

Parameters:
filename : str

File name of the package parameters definition file (*.ppd); Either absolute or relative to the ‘Parameter’ directory. Leave out to save the definitions to its existing file (previously set with Save() or from ParameterApi.OpenPackageParametersDefinition())

allowCompatibilityFallback : bool

If True and a compatibility mode is active, save in the minimum compatible version when needed. If False, compatibility problems raise an exception instead.

SetDescription(name, description)

Sets the description of the parameter specified by the given name.

Parameters:
name : str

Name of the parameter to set the description of

description : str

Description of the parameter to be set

Raises:
  • ApiError – If the parameter with the given name does not exist

  • ApiError – If description is no str

SetValue(name, value=None)

Sets the value of the parameter specified by the given name.

Parameters:
name : str

Name of the parameter to set the value of

value : str

Value of the parameter as you would type it in the editor (i.e. for strings you need to include the quotes!) Can be set to ‘None’ to reset the parameter value.

Raises:
  • ApiError – If the parameter with the given name does not exist

  • ApiError – If the value is no valid expression