'Pre-condition: `step` is an ORM object coming from the database, if
supplied `step_args` is the representation of the inputs for that step
supplied via web form.
Post-condition: The supplied `step` has new non-persistent attributes
useful during workflow invocation. These include \'upgrade_messages\',
\'state\', \'input_connections_by_name\', and \'module\'.
If step_args is provided from a web form this is applied to generate
\'state\' else it is just obtained from the database.'

def inject(self, step, step_args=None, steps=None):

    step_errors = None
    step.upgrade_messages = {}
    step.setup_input_connections_by_name()
    module = step.module = module_factory.from_workflow_step(self.trans, step)
    step.upgrade_messages = module.check_and_update_state()
    module.add_dummy_datasets(connections=step.input_connections, steps=steps)
    (state, step_errors) = module.compute_runtime_state(self.trans, step_args)
    step.state = state
    if (step.type == 'subworkflow'):
        subworkflow = step.subworkflow
        populate_module_and_state(self.trans, subworkflow, param_map={})
    return step_errors
