Program entities
ProgramInterface
- class business_logic.models.ProgramInterface(*args, **kwargs)
Determines interface for
business_logic.models.Program
. Should be configured by adding one or morebusiness_logic.models.ProgramArgument
. Can hold link tobusiness_logic.models.ExecutionEnvironment
.- title
human-readable name
- Type:
str
- code
machine-readable code for programmatic access
- Type:
str
- environment
execution environment, can be empty
- programs
queryset of child Program
ProgramArgument
- class business_logic.models.ProgramArgument(id, program_interface, name, content_type, variable_definition)
ProgramArgumentField
Program
- class business_logic.models.Program(*args, **kwargs)
Implements
business_logic.models.ProgramInterface
. Can hold link tobusiness_logic.models.ExecutionEnvironment
.- title
human-readable name
- Type:
str
- code
machine-readable code for programmatic access
- Type:
str
- environment
execution environment, can be empty
- program_interface
implemented interface
- versions
queryset of child ProgramVersion
ProgramVersion
- class business_logic.models.ProgramVersion(*args, **kwargs)
Acts as version of
business_logic.models.Program
. Main holder of visually editable code. Can hold link tobusiness_logic.models.ExecutionEnvironment
.- title
human-readable name
- Type:
str
- description
human-readable description
- Type:
str
- environment
execution environment, can be empty
- is_default
default=False, can be used for choosing suitable ProgramVersion. Only one ProgramVersion for given :class:`business_logic.models.Program can have this field value as True
- Type:
bool
- entry_point
entry point of visually editable code
- program
parent Program
- copy(new_title)
Creates a copy of self with given title. Suitable for “save as” actions.
- Parameters:
new_title – str new title
- Returns:
new
business_logic.models.ProgramVersion
instance
- execute(context=None, **kwargs)
Main function for program execution
- Parameters:
context (
business_logic.models.Context
, optional) – Context instance**kwargs – program arguments
- Returns:
Context instance
- Return type:
- Raises:
KeyError – If any of program argument omitted
AssertionError – if any of program argument have incorrect type, if passed unregistered program argument
Todo
create own exceptions instead AssertionError/KeyError/etc