Returns the template context, including the workflow class.

        This method should be overridden in subclasses to provide additional
        context data to the template.
333434
def get_context_data(self, **kwargs):
        
        context = super(WorkflowView, self).get_context_data(**kwargs)
        workflow = self.get_workflow()
        workflow.verify_integrity()
        context[self.context_object_name] = workflow
        next = self.request.GET.get(workflow.redirect_param_name)
        context['REDIRECT_URL'] = next
        context['layout'] = self.get_layout()
        # For consistency with Workflow class
        context['modal'] = 'modal' in context['layout']

        if ADD_TO_FIELD_HEADER in self.request.META:
            context['add_to_field'] = self.request.META[ADD_TO_FIELD_HEADER]
        return context
900130
def get_context(self, **kwargs):
        
        context = self.get_context_data(form=self.form_obj, **kwargs)
        context.update(super(FormAdminView, self).get_context())
        return context
543850
public TemplateClass __getTemplateClass(boolean useCaller) {
        TemplateClass tc = __templateClass;
        if (useCaller && null == tc) {
            TemplateBase caller = __caller();
            if (null != caller) return caller.__getTemplateClass(true);
        }
        return tc;
    }
770854
private function createWorkflow()
    {
        $workflowId = $this->workflowContext instanceof WorkflowContextInterface ? $this->workflowContext->getWorkflowId() : $this->workflowContext;
        $workflow = $this->workflowRepository->findById($workflowId);
        if ($workflow === null) {
            throw new WorkflowNotFoundException(sprintf('The workflow "%s" is not found.', $workflowId));
        }

        return $workflow;
    }
761929
def get(self):
        
        return TaskActionsContext(
            self._version,
            assistant_sid=self._solution['assistant_sid'],
            task_sid=self._solution['task_sid'],
        )
787612
def get_context_data(self):
        
        self.get_context()
        self.context_data.update(self.get_extra_context())
        return self.context_data
251516
def serialize_workflow(self):
        
        self.workflow.refresh_waiting_tasks()
        return CompactWorkflowSerializer().serialize_workflow(self.workflow,
                                                              include_spec=False)
860138
async def update_template_context(self, context: dict) -> None:
        
        processors = self.template_context_processors[None]
        if has_request_context():
            blueprint = _request_ctx_stack.top.request.blueprint
            if blueprint is not None and blueprint in self.template_context_processors:
                processors = chain(processors, self.template_context_processors[blueprint])  # type: ignore # noqa
        extra_context: dict = {}
        for processor in processors:
            extra_context.update(await processor())
        original = context.copy()
        context.update(extra_context)
        context.update(original)
1006232
def get_context_template():
    
    import random
    return {
        'SITE_ID': 1,
        'SECRET_KEY': ''.join(
            [random.SystemRandom().choice('abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)') for i in range(50)]),
        'DATA_DIR': os.path.join(os.environ['PRODUCT_DIR'], '__data__'),
    }
460989
def get_email_context(self,**kwargs):
        '''  '''
        context = super(Invoice,self).get_email_context(**kwargs)
        context.update({
            'id': self.id,
            'url': '%s?v=%s' % (self.url, self.validationString),
            'amountPaid': self.amountPaid,
            'outstandingBalance': self.outstandingBalance,
            'status': self.statusLabel,
            'creationDate': self.creationDate,
            'modifiedDate': self.modifiedDate,
            'paidOnline': self.paidOnline,
            'grossTotal': self.grossTotal,
            'total': self.total,
            'adjustments': self.adjustments,
            'taxes': self.taxes,
            'fees': self.fees,
            'comments': self.comments,
        })
        return context
641215
def context(self):
        
        ret = libxml2mod.xmlXPathParserGetContext(self._o)
        if ret is None:raise xpathError('xmlXPathParserGetContext() failed')
        __tmp = xpathContext(_obj=ret)
        return __tmp
1172561
private ThreadContextDescriptor appendInflowContext() throws WorkCompletedException {
        ThreadContextDescriptor merged = threadContextDescriptor.clone();
        Set<String> inflowContext = new HashSet<String>();

        // WorkContext
        if (workContexts != null)
            for (WorkContext workContext : workContexts)
                if (workContext instanceof HintsContext) {
                    if (hintsContextSetupFailure != null)
                        throw contextSetupFailure(workContext, WorkContextErrorCodes.CONTEXT_SETUP_FAILED, hintsContextSetupFailure);
                } else {
                    JCAContextProvider provider = bootstrapContext.getJCAContextProvider(workContext.getClass());
                    if (provider == null)
                        throw contextSetupFailure(workContext, WorkContextErrorCodes.UNSUPPORTED_CONTEXT_TYPE, null);
                    else {
                        ThreadContext context;
                        try {
                            context = provider.getInflowContext(workContext, executionProperties);
                        } catch (Throwable x) {
                            throw contextSetupFailure(workContext, WorkContextErrorCodes.CONTEXT_SETUP_FAILED, x);
                        }
                        String workContextProviderName = bootstrapContext.getJCAContextProviderName(workContext.getClass());
                        if (!inflowContext.add(workContextProviderName))
                            throw contextSetupFailure(workContext, WorkContextErrorCodes.DUPLICATE_CONTEXTS, null);
                        merged.set(workContextProviderName, context);
                    }
                }

        // ExecutionContext
        if (executionContext != null)
            if (inflowContext.isEmpty() && (executionContext.getXid() != null || executionContext.getTransactionTimeout() != WorkManager.UNKNOWN)) {
                JCAContextProvider provider = bootstrapContext.getJCAContextProvider(TransactionContext.class);
                if (provider == null)
                    throw contextSetupFailure(executionContext, WorkContextErrorCodes.UNSUPPORTED_CONTEXT_TYPE, null);
                ThreadContext context;
                try {
                    context = provider.getInflowContext(executionContext, executionProperties);
                } catch (Throwable x) {
                    throw contextSetupFailure(executionContext, WorkContextErrorCodes.CONTEXT_SETUP_FAILED, x);
                }
                String executionContextHandlerName = bootstrapContext.getJCAContextProviderName(TransactionContext.class);
                merged.set(executionContextHandlerName, context);
            } // else - already checked for this error condition earlier

        return merged;
    }
479903
def get_context(self):
        
        if not self.context:
            return
        else:
            assert isinstance(self.context, tuple), 'Expected a Tuple not {0}'.format(type(self.context))
        for model in self.context:
            model_cls = utils.get_model_class(model)
            key = utils.camel_to_snake(model_cls.__name__)
            self.context_data[key] = self.get_instance_of(model_cls)
652838
def load_workflow_from_cache(self):
        
        if not self.current.new_token:
            self.wf_state = self.current.wf_cache.get(self.wf_state)
            self.current.task_data = self.wf_state['data']
            self.current.set_client_cmds()
            self.current.pool = self.wf_state['pool']
            return self.wf_state['step']
511461
public function getNamedTemplate($name)
    {
        if ($importedTemplate = singleton(WorkflowDefinitionImporter::class)->getImportedWorkflows($name)) {
            return $importedTemplate;
        }

        if (!is_array($this->templates)) {
            return;
        }
        foreach ($this->templates as $template) {
            if ($template->getName() == $name) {
                return $template;
            }
        }
    }
970422
def _cwl_workflow_template(inputs, top_level=False):
    
    ready_inputs = []
    for inp in inputs:
        cur_inp = copy.deepcopy(inp)
        for attr in ["source", "valueFrom", "wf_duplicate"]:
            cur_inp.pop(attr, None)
        if top_level:
            cur_inp = workflow._flatten_nested_input(cur_inp)
        cur_inp = _clean_record(cur_inp)
        ready_inputs.append(cur_inp)
    return {"class": "Workflow",
            "cwlVersion": "v1.0",
            "hints": [],
            "requirements": [{"class": "EnvVarRequirement",
                              "envDef": [{"envName": "MPLCONFIGDIR", "envValue": "."}]},
                             {"class": "ScatterFeatureRequirement"},
                             {"class": "SubworkflowFeatureRequirement"}],
            "inputs": ready_inputs,
            "outputs": [],
            "steps": []}
1215791
def getFormTemplate(self):
        
        templates_dir = self._TEMPLATES_DIR
        embedt = self.request.get('template', self._DEFAULT_TEMPLATE)
        if embedt.find(':') >= 0:
            prefix, embedt = embedt.split(':')
            templates_dir = queryResourceDirectory(self._TEMPLATES_ADDON_DIR, prefix).directory
        embed = ViewPageTemplateFile(os.path.join(templates_dir, embedt))
        reptemplate = ""
        try:
            reptemplate = embed(self)
        except:
            tbex = traceback.format_exc()
            wsid = self._samplingrounds[self._current_sr_index].id
            reptemplate = "<div class='error-print'>%s - %s '%s':<pre>%s</pre></div>" % (wsid, _("Unable to load the template"), embedt, tbex)
        if self._current_sr_index < len(self._samplingrounds):
            self._current_sr_index += 1
        return reptemplate