Load the component sub-nodes that correspond to template attributes
169509
function () {
    this.attEltNodes=null;
    this._attGenerators=null;

    // determine the possible template attribute names
    var tpAttNames={}, ca=this.ctlAttributes, defaultTplAtt=null, lastTplAtt=null, count=0;
    for (var k in ca) {
      if (ca.hasOwnProperty(k) && ca[k].type==="template") {
        // k is defined in the controller attributes collection
        // so k is a valid template attribute name
        tpAttNames[k]=true;
        count++;
        if (ca[k].defaultContent) {
          defaultTplAtt=k;
        }
        lastTplAtt=k;
      }
    }

    // if there is only one template attribute it will be automatically considered as default
    if (!defaultTplAtt) {
      if (count===1) {
        defaultTplAtt=lastTplAtt;
      } else if (count>1) {
        // error: a default must be defined
        log.error(this+" A default content element must be defined when multiple content elements are supported");
        // use last as default
        defaultTplAtt=lastTplAtt;
      }
    }

    // check if a default attribute element has to be created and create it if necessary
    this.manageDefaultAttElt(defaultTplAtt);

    // Analyze node attributes to see if a template attribute is passed as text attribute
    var atts=this.atts, att, nm;
    if (atts) {
      for (var k in atts) {
        if (!atts.hasOwnProperty(k)) continue;
        att=atts[k];
        nm=att.name;
        if (tpAttNames[nm]) {
          // nm is a template attribute passed as text attribute
          if (this.tplAttributes && this.tplAttributes[nm]) {
            // already defined: raise an error

            log.error(this+" Component attribute '" + nm + "' is defined multiple times - please check");
          } else {
            // create new tpl Attribute Text Node and add it to the tplAttributes collection
            if (!att.generator) {
              var txtNode;
              if (att.value) {
                // static value
                txtNode = new $TextNode(0,[""+att.value]);
              } else {
                // dynamic value using expressions
                txtNode = new $TextNode(this.exps,atts[k].textcfg);
              }
              if (!this._attGenerators) {
                this._attGenerators = [];
              }
              att.generator = new $CptAttElement(nm,0,0,0,[txtNode]); // name, exps, attcfg, ehcfg, children
              this._attGenerators.push(att.generator);
            }
            // generate a real $CptAttElement using the TextNode as child element
            var ni=att.generator.createNodeInstance(this);
            ni.isCptContent=true;
            if (!this.attEltNodes) {
              this.attEltNodes=[];
            }
            this.attEltNodes.push(ni);
            // attribute elements will automatically register through registerAttElement()
          }
        }
      }
    }

    this.retrieveAttElements();
  }
1068628
def LoadFromXml(self, node, handle):
		
		from Ucs import ClassFactory

		self.SetHandle(handle)
		if node.hasAttributes():
			# attributes = node._get_attributes()
			# attCount = attributes._get_length()
			attributes = node.attributes
			attCount = len(attributes)
			for i in range(attCount):
				attNode = attributes.item(i)
				# attr = UcsUtils.WordU(attNode._get_name())
				attr = UcsUtils.WordU(attNode.localName)
				if (attr in UcsUtils.GetUcsPropertyMetaAttributeList(self.classId)):
					atMeta = UcsUtils.GetUcsMethodMeta(self.classId, attr)
					if ((atMeta.io == "Input") or (atMeta.isComplexType)):
						continue
					# self.setattr(attr, str(attNode.nodeValue))
					self.setattr(attr, str(attNode.value))
				# elif (attNode._get_name() in externalMethodAttrs):
				#	self.setattr(attNode._get_name(), str(attNode.nodeValue))
				elif (attNode.localName in externalMethodAttrs):
					self.setattr(attNode.localName, str(attNode.value))

		if (node.hasChildNodes()):
			# childList = node._get_childNodes()
			# childCount = childList._get_length()
			childList = node.childNodes
			childCount = len(childList)
			for i in range(childCount):
				childNode = childList.item(i)
				if (childNode.nodeType != Node.ELEMENT_NODE):
					continue

				cln = UcsUtils.WordU(childNode.localName)
				if cln in UcsUtils.GetUcsPropertyMetaAttributeList(self.classId):
					atMeta = UcsUtils.GetUcsMethodMeta(self.classId, cln)
					if ((atMeta.io == "Output") and (atMeta.isComplexType)):
						c = ClassFactory(atMeta.fieldType)
						if (c != None):
							self.setattr(cln, c)
							c.LoadFromXml(childNode, handle)
683391
function(rootNode, includeRoot) {
			var arr = null,
				out = [],
				classList = [],
				items,
				x,
				i,
				y,
				key;


			// build an array of v1 root names
			for(key in modules.maps) {
				if (modules.maps.hasOwnProperty(key)) {
					classList.push(modules.maps[key].root);
				}
			}

			// get all elements that have a class attribute
			includeRoot = (includeRoot) ? includeRoot : false;
			if(includeRoot && rootNode.parentNode) {
				arr = modules.domUtils.getNodesByAttribute(rootNode.parentNode, 'class');
			} else {
				arr = modules.domUtils.getNodesByAttribute(rootNode, 'class');
			}

			// loop elements that have a class attribute
			x = 0;
			i = arr.length;
			while(x < i) {

				items = modules.domUtils.getAttributeList(arr[x], 'class');

				// loop classes on an element
				y = items.length;
				while(y--) {
					// match v1 root names
					if(classList.indexOf(items[y]) > -1) {
						out.push(arr[x]);
						break;
					}

					// match v2 root name prefix
					if(modules.utils.startWith(items[y], 'h-')) {
						out.push(arr[x]);
						break;
					}
				}

				x++;
			}
			return out;
		}
1033064
function () {
                var children = [],
                    addedDescriptors = [],
                    i, child;

                if (this.$defaultContentName && this.$defaultTemplateName) {
                    throw "both $defaultContentName and $defaultTemplateName are defined";
                }

                var desc;

                function addChildren(childrenFromDescriptor, fromDescriptor) {

                    // don't add children with the same descriptor twice
                    for (var j = 0; j < childrenFromDescriptor.length; j++) {
                        child = childrenFromDescriptor[j];
                        child.$fromDescriptor = fromDescriptor;

                        if (child.$createdByTemplate || _.indexOf(addedDescriptors, child.$descriptor) === -1) {
                            children.push(child);
                            if (child.$descriptor) {
                                addedDescriptors.push(child.$descriptor);
                            }
                        }
                    }
                }

                for (var d = 0; d < this.$internalDescriptors.length; d++) {
                    desc = this.$internalDescriptors[d];
                    addChildren(this._getChildrenFromDescriptor(desc, this, null, this), "intern");
                }

                var externalDescriptorChildren;

                if (this.$defaultTemplateName) {
                    var templateBlock;

                    // go through all children from the external descriptor
                    // and check if a template block with the name $defaultTemplateName

                    for (i = 0; i < this.$descriptor.childNodes.length; i++) {
                        var node = this.$descriptor.childNodes[i];

                        if (node.nodeType === 1 &&
                            node.getAttribute("name") === this.$defaultTemplateName &&
                            this.$stage.$applicationContext.getFqClassName(node.namespaceURI, this._localNameFromDomNode(node), true) === "js/core/Template") {

                            templateBlock = node;
                            break;
                        }
                    }

                    if (!templateBlock && this.$descriptor) {
                        templateBlock = this.createComponent(Component.Template, {
                            name: this.$defaultTemplateName
                        }, this.$descriptor);

                        externalDescriptorChildren = [templateBlock];
                    }

                }

                externalDescriptorChildren = externalDescriptorChildren || this._getChildrenFromDescriptor(this.$descriptor);


                if (this.$defaultContentName && this.$descriptor) {
                    // check if content block is already defined
                    var contentBlock,
                        internAndExternalChildren = children.concat(externalDescriptorChildren);


                    for (i = 0; i < internAndExternalChildren.length; i++) {
                        child = internAndExternalChildren[i];

                        if (child instanceof Component.Content && child.$.name === this.$defaultContentName) {
                            // content block already defined
                            contentBlock = child;
                            break;
                        }
                    }

                    if (!contentBlock) {
                        // create a content block and move all children in a js.core.Content Block
                        contentBlock = this.createComponent(Component.Content, {
                            name: this.$defaultContentName
                        });

                        // add all children to content block
                        for (i = 0; i < externalDescriptorChildren.length; i++) {
                            contentBlock.addChild(externalDescriptorChildren[i]);
                        }

                        externalDescriptorChildren = [contentBlock];
                    }

                }

                addChildren(externalDescriptorChildren, "external");

                var extraChildren = this.createChildren();
                if (extraChildren) {
                    addChildren(extraChildren, "extra");
                }

                this._initializeChildren(children);

                this._childrenInitialized();

                this._initializeXamlEventAttributes(this.$xamlDefaults, this);
                this._initializeXamlEventAttributes(this.$xamlAttributes, this.$rootScope);
            }
1215453
function(el, tagName, tagData) {
                var helperTagCallback = tagData.options.read('tags.' + tagName, {
                        isArgument: true,
                        proxyMethods: false
                    })
                    .value,
                    tagCallback = helperTagCallback || tags[tagName];

                // If this was an element like <foo-bar> that doesn't have a component, just render its content
                var scope = tagData.scope,
                    res;

                if (tagCallback) {
                    var reads = can.__clearReading();
                    res = tagCallback(el, tagData);
                    can.__setReading(reads);
                } else {
                    res = scope;
                }



                // If the tagCallback gave us something to render with, and there is content within that element
                // render it!
                if (res && tagData.subtemplate) {

                    if (scope !== res) {
                        scope = scope.add(res);
                    }
                    var result = tagData.subtemplate(scope, tagData.options);
                    var frag = typeof result === "string" ? can.view.frag(result) : result;
                    can.appendChild(el, frag);
                }
            }
222672
def load_dom(self, domtree, initialize=True):
        
        if domtree.nodeType == Node.DOCUMENT_NODE:
            rootElement = domtree.documentElement
        elif domtree.nodeType == Node.ELEMENT_NODE:
            rootElement = domtree
        else:
            raise InvalidManifestError("Invalid root element node type " + 
                                       str(rootElement.nodeType) + 
                                       " - has to be one of (DOCUMENT_NODE, "
                                       "ELEMENT_NODE)")
        allowed_names = ("assembly", "assemblyBinding", "configuration", 
                         "dependentAssembly")
        if rootElement.tagName not in allowed_names:
            raise InvalidManifestError(
                "Invalid root element <%s> - has to be one of <%s>" % 
                (rootElement.tagName, ">, <".join(allowed_names)))
        # logger.info("loading manifest metadata from element <%s>", rootElement.tagName)
        if rootElement.tagName == "configuration":
            for windows in rootElement.getCEByTN("windows"):
                for assemblyBinding in windows.getCEByTN("assemblyBinding"):
                    self.load_dom(assemblyBinding, initialize)
        else:
            if initialize:
                self.__init__()
            self.manifestType = rootElement.tagName
            self.manifestVersion = [int(i) 
                                    for i in 
                                    (rootElement.getA("manifestVersion") or 
                                     "1.0").split(".")]
            self.noInheritable = bool(rootElement.getFCEByTN("noInheritable"))
            self.noInherit = bool(rootElement.getFCEByTN("noInherit"))
            for assemblyIdentity in rootElement.getCEByTN("assemblyIdentity"):
                self.type = assemblyIdentity.getA("type") or None
                self.name = assemblyIdentity.getA("name") or None
                self.language = assemblyIdentity.getA("language") or None
                self.processorArchitecture = assemblyIdentity.getA(
                    "processorArchitecture") or None
                version = assemblyIdentity.getA("version")
                if version:
                    self.version = [int(i) for i in version.split(".")]
                self.publicKeyToken = assemblyIdentity.getA("publicKeyToken") or None
            for publisherPolicy in rootElement.getCEByTN("publisherPolicy"):
                self.applyPublisherPolicy = (publisherPolicy.getA("apply") or 
                                             "").lower() == "yes"
            for description in rootElement.getCEByTN("description"):
                if description.firstChild:
                    self.description = description.firstChild.wholeText
            for trustInfo in rootElement.getCEByTN("trustInfo"):
                for security in trustInfo.getCEByTN("security"):
                    for reqPriv in security.getCEByTN("requestedPrivileges"):
                        for reqExeLev in reqPriv.getCEByTN("requestedExecutionLevel"):
                            self.requestedExecutionLevel = reqExeLev.getA("level")
                            self.uiAccess = (reqExeLev.getA("uiAccess") or 
                                             "").lower() == "true"
            if rootElement.tagName == "assemblyBinding":
                dependencies = [rootElement]
            else:
                dependencies = rootElement.getCEByTN("dependency")
            for dependency in dependencies:
                for dependentAssembly in dependency.getCEByTN(
                    "dependentAssembly"):
                    manifest = ManifestFromDOM(dependentAssembly)
                    if not manifest.name:
                        # invalid, skip
                        continue
                    manifest.optional = (dependency.getA("optional") or 
                                         "").lower() == "yes"
                    self.dependentAssemblies.append(manifest)
                    if self.filename:
                        # Enable search for private assembly by assigning bogus 
                        # filename (only the directory has to be correct)
                        self.dependentAssemblies[-1].filename = ":".join(
                            (self.filename, manifest.name))
            for bindingRedirect in rootElement.getCEByTN("bindingRedirect"):
                oldVersion = [[int(i) for i in part.split(".")] 
                              for part in 
                              bindingRedirect.getA("oldVersion").split("-")]
                newVersion = [int(i) 
                              for i in 
                              bindingRedirect.getA("newVersion").split(".")]
                self.bindingRedirects.append((oldVersion, newVersion))
            for file_ in rootElement.getCEByTN("file"):
                self.add_file(name=file_.getA("name"),
                              hashalg=file_.getA("hashalg"),
                              hash=file_.getA("hash"))
314571
def setComponents(self, components):
        
        layout = self.layout()
        for comp in components:
            attrWidget = ComponentAttributerChecker(comp)
            layout.addWidget(attrWidget)
1171526
def _load_xml(self):
        
        if self._xml is not None:
            return
        matcher = "\[(?:Normal|Conditional) Substitution\(index=(\d+), type=\d+\)\]"
        self._xml = re.sub(matcher, "{\\1:}",
                           self._template_node.template_format().replace("{", "{{").replace("}", "}}"))
657112
def _load_templates(workflow: dict, templates_root: str):
    """"""
    workflow_template_path = join(templates_root, workflow['id'],
                                  workflow['version'])
    for i, stage_config in enumerate(workflow['stages']):
        stage_template_path = join(workflow_template_path,
                                   stage_config['id'],
                                   stage_config['version'])
        for config_type in ['ee_config', 'app_config']:
            for key, value in stage_config[config_type].items():
                if 'template' in key:
                    template_file = join(stage_template_path, value)
                    with open(template_file, 'r') as file:
                        template_str = file.read()
                        workflow['stages'][i][config_type][key] = template_str
463698
function renderContent(data, context, parentView, key, isLayout, onRender) {
		// Render template against data as a tree of subviews (nested rendered template instances), or as a string (top-level template).
		// If the data is the parent view, treat as layout template, re-render with the same data context.
		var i, l, dataItem, newView, childView, itemResult, props, swapContent, tagCtx, tag_, outerOnRender, tmplName,
			self = this,
			tmpl = self,
			allowDataLink = !self.attr || self.attr === "html",
			result = "";

		if (key === TRUE) {
			swapContent = TRUE;
			key = 0;
		}
		if (self._is === "tag") {
			tag_ = self._;
			tmplName = self.tagName;
			tagCtx = self.tagCtx;
			// This is a call from renderTag
			tmpl = tagCtx.isElse ? tag_.elses[tagCtx.isElse-1] : tag_.tmpl;
			context = extendCtx(context, self.ctx);
			props = tagCtx.props;
			if ( props.link === FALSE ) {
				// link=false setting on block tag
				// We will override inherited value of link by the explicit setting link=false taken from props
				// The child views of an unlinked view are also unlinked. So setting child back to true will not have any effect.
				context =  context || {};
				context.link = FALSE;
			}
			parentView = parentView || tagCtx.view;
			data = data === undefined ?  parentView : data;
		} else {
			tmpl = self.jquery && (self[0] || error('Unknown template: "' + self.selector + '"')) // This is a call from $(selector).render
				|| self;
		}
		if (tmpl) {
			if (parentView) {
				onRender = onRender || parentView._.onRender;
				if (data === parentView) {
					// Inherit the data from the parent view.
					// This may be the contents of an {{if}} block
					// Set isLayout = true so we don't iterate the if block if the data is an array.
					data = parentView.data;
					isLayout = TRUE;
				}
				context = extendCtx(context, parentView.ctx);
			} else {
				(context = context || {}).root = data; // Provide ~root as shortcut to top-level data.
			}

			// Set additional context on views created here, (as modified context inherited from the parent, and to be inherited by child views)
			// Note: If no jQuery, $extend does not support chained copies - so limit extend() to two parameters

			if (!tmpl.fn) {
				tmpl = $templates[tmpl] || $templates(tmpl);
			}

			if (tmpl) {
				onRender = (context && context.link) !== FALSE && allowDataLink && onRender;
				// If link===false, do not call onRender, so no data-linking marker nodes
				outerOnRender = onRender;
				if (onRender === TRUE) {
					// Used by view.refresh(). Don't create a new wrapper view.
					outerOnRender = undefined;
					onRender = parentView._.onRender;
				}
				if ($.isArray(data) && !isLayout) {
					// Create a view for the array, whose child views correspond to each data item. (Note: if key and parentView are passed in
					// along with parent view, treat as insert -e.g. from view.addViews - so parentView is already the view item for array)
					newView = swapContent ? parentView : (key !== undefined && parentView) || View(context, "array", parentView, data, tmpl, key, onRender);
					for (i = 0, l = data.length; i < l; i++) {
						// Create a view for each data item.
						dataItem = data[i];
						childView = View(context, "item", newView, dataItem, tmpl, (key || 0) + i, onRender);
						itemResult = tmpl.fn(dataItem, childView, $views);
						result += newView._.onRender ? newView._.onRender(itemResult, childView) : itemResult;
					}
				} else {
					// Create a view for singleton data object. The type of the view will be the tag name, e.g. "if" or "myTag" except for
					// "item", "array" and "data" views. A "data" view is from programatic render(object) against a 'singleton'.
					newView = swapContent ? parentView : View(context, tmplName||"data", parentView, data, tmpl, key, onRender);
					if (tag_ && !self.flow) {
						newView.tag = self;
					}
					result += tmpl.fn(data, newView, $views);
				}
				return outerOnRender ? outerOnRender(result, newView) : result;
			}
		}
		return "";
	}
425027
function() {
    var c=[], ce=this.childElements, celts=this.ctlElements, eltType;
    if (ce && ce.length) {
      for (var i=0, sz=ce.length;sz>i;i++) {
        eltType=celts[ce[i].name].type;
        if (eltType==="component") {
          c.push(ce[i].controller);
        } else if (eltType==="template") {
          c.push(ce[i]);
        } else {
          log.error(this+" Invalid element type: "+eltType);
        }
      }
    }
    return c.length>0? c : null;
  }
76645
def load_fixture(filename, kind, post_processor=None):
    

    def _load(od, kind, post_processor, parent=None, presets={}):
        """
        Loads a single dictionary (od) into an object, overlays the values in
        presets, persists it and
        calls itself on the objects in __children__* keys
        """
        if hasattr(kind, 'keys'):  # kind is a map
            objtype = kind[od['__kind__']]
        else:
            objtype = kind

        obj_id = od.get('__id__')
        if obj_id is not None:
            obj = objtype(id=obj_id, parent=parent)
        else:
            obj = objtype(parent=parent)

        # Iterate over the non-special attributes and overlay the presets
        for attribute_name in [k for k in od.keys()
                               if not k.startswith('__') and
                               not k.endswith('__')] + presets.keys():
            attribute_type = objtype.__dict__[attribute_name]
            attribute_value = _sensible_value(attribute_type,
                                              presets.get(
                                                  attribute_name,
                                                  od.get(attribute_name)))
            obj.__dict__['_values'][attribute_name] = attribute_value

        if post_processor:
            post_processor(obj)

        # Saving obj is required to continue with the children
        obj.put()

        loaded = [obj]

        # Process ancestor-based __children__
        for item in od.get('__children__', []):
            loaded.extend(_load(item, kind, post_processor, parent=obj.key))

        # Process other __children__[key]__ items
        for child_attribute_name in [k for k in od.keys()
                                     if k.startswith('__children__')
                                     and k != '__children__']:
            attribute_name = child_attribute_name.split('__')[-2]

            for child in od[child_attribute_name]:
                loaded.extend(_load(child, kind, post_processor,
                                    presets={attribute_name: obj.key}))

        return loaded

    tree = json.load(open(filename))

    loaded = []

    # Start with the top-level of the tree
    for item in tree:
        loaded.extend(_load(item, kind, post_processor))

    return loaded
328445
function(node) {
      var i;
      var j;
      var k;
      var l;
      var componentName;
      var componentNode;
      // Get the component path
      var componentPath = [];
      while (node) {
        if (node.property && node.property.type === 'Identifier') {
          componentPath.push(node.property.name);
        }
        if (node.object && node.object.type === 'Identifier') {
          componentPath.push(node.object.name);
        }
        node = node.object;
      }
      componentPath.reverse();
      componentName = componentPath.slice(0, componentPath.length - 1).join('.');

      // Find the variable in the current scope
      var variableName = componentPath.shift();
      if (!variableName) {
        return null;
      }
      var variableInScope;
      var variables = variableUtil.variablesInScope(context);
      for (i = 0, j = variables.length; i < j; i++) {
        if (variables[i].name === variableName) {
          variableInScope = variables[i];
          break;
        }
      }
      if (!variableInScope) {
        return null;
      }

      // Try to find the component using variable references
      var refs = variableInScope.references;
      var refId;
      for (i = 0, j = refs.length; i < j; i++) {
        refId = refs[i].identifier;
        if (refId.parent && refId.parent.type === 'MemberExpression') {
          refId = refId.parent;
        }
        if (sourceCode.getText(refId) !== componentName) {
          continue;
        }
        if (refId.type === 'MemberExpression') {
          componentNode = refId.parent.right;
        } else if (refId.parent && refId.parent.type === 'VariableDeclarator') {
          componentNode = refId.parent.init;
        }
        break;
      }

      if (componentNode) {
        // Return the component
        return components.add(componentNode, 1);
      }

      // Try to find the component using variable declarations
      var defInScope;
      var defs = variableInScope.defs;
      for (i = 0, j = defs.length; i < j; i++) {
        if (defs[i].type === 'ClassName' || defs[i].type === 'FunctionName' || defs[i].type === 'Variable') {
          defInScope = defs[i];
          break;
        }
      }
      if (!defInScope || !defInScope.node) {
        return null;
      }
      componentNode = defInScope.node.init || defInScope.node;

      // Traverse the node properties to the component declaration
      for (i = 0, j = componentPath.length; i < j; i++) {
        if (!componentNode.properties) {
          continue;
        }
        for (k = 0, l = componentNode.properties.length; k < l; k++) {
          if (componentNode.properties[k].key.name === componentPath[i]) {
            componentNode = componentNode.properties[k];
            break;
          }
        }
        if (!componentNode || !componentNode.value) {
          return null;
        }
        componentNode = componentNode.value;
      }

      // Return the component
      return components.add(componentNode, 1);
    }
153658
def load_default_templates(self):
        """"""
        for importer, modname, is_pkg in pkgutil.iter_modules(templates.__path__):
            self.register_template('.'.join((templates.__name__, modname)))
546996
function() {
    // determine if cpt supports template arguments
    if (this.template) {
      // as template can be changed dynamically we have to sync the constructor
      this.ctlConstuctor=this.template.controllerConstructor;
    }
    var ctlProto=this.ctlConstuctor.prototype;
    this.ctlAttributes=ctlProto.$attributes;
    this.ctlElements=ctlProto.$elements;

    // load template arguments
    this.loadCptAttElements();

    // load child elements before processing the template
    var cptArgs={
      nodeInstance:this,
      $attributes:{},
      $content:null
    };
    var attributes=cptArgs.$attributes, att;

    if (this.atts) {
      // some attributes have been passed to this instance - so we push them to cptArgs
      // so that they are set on the controller when the template are rendered
      var atts = this.atts, eh = this.eh, pvs = this.vscope, nm;
      if (atts) {
        for (var i = 0, sz = this.atts.length; sz > i; i++) {
          att = atts[i];
          nm = att.name;
          if (this.ctlAttributes[nm].type!=="template") {
            attributes[nm]=att.getValue(eh, pvs, null);
          }
        }
      }
    }

    if (this.tplAttributes) {
      var tpa=this.tplAttributes;
      for (var k in tpa) {
        // set the template attribute value on the controller
        if (tpa.hasOwnProperty(k)) {
          attributes[k]=tpa[k];
        }
      }
    }
    if (this.childElements) {
      cptArgs.$content=this.getControllerContent();
    }
    return cptArgs;
  }
662806
def _load(self):
        """"""
        if os.path.exists(self.path):
            root = ET.parse(self.path).getroot()
            if (root.tag == "fortpy" and "mode" in root.attrib and
                root.attrib["mode"] == "template" and "direction" in root.attrib and
                root.attrib["direction"] == self.direction):
                #First, we need instances of the template contents for each of the
                #versions listed in the fortpy tag.
                for v in _get_xml_version(root):
                    self.versions[v] = TemplateContents()
                #Now we can update the contents objects using the XML data.
                self._load_entries(root)

                #See if a custom name was specified for the auto-converted
                #files.
                if "autoname" in root.attrib:
                    self.name = root.attrib["autoname"]
            else:
                msg.err("the specified template {} ".format(self.path) + 
                        "is missing the mode and direction attributes.")
                exit(1)
        else:
            msg.err("could not find the template {}.".format(self.path))
            exit(1)
1091166
@Override
    public Optional<TemplateContentData> load(String responseTemplateName, Input input) throws TemplateLoaderException {
        TemplateEnumerator templateEnumerator = templateEnumeratorSupplier.apply(responseTemplateName, input);
        while (templateEnumerator.hasNext()) {
            String templateName = (String) templateEnumerator.next();
            String templatePath = buildCompletePath(templateName);
            try {
                URI templateUri = getResourceURI(templatePath);
                if (templateUri != null) {
                    String templateIdentifier = templateUri.toString();
                    TemplateContentData templateContentData = templateCache.get(templateIdentifier);
                    if (templateContentData == null) {
                        try (InputStream inputStream = getTemplateAsStream(templatePath)) {
                            byte[] templateByteArray = new byte[inputStream.available()];
                            inputStream.read(templateByteArray);
                            templateContentData = TemplateContentData.builder()
                                    .withIdentifier(templateIdentifier)
                                    .withTemplateContent(templateByteArray)
                                    .withTemplateBaseDir(directoryPath)
                                    .build();
                        } catch (IOException e) {
                            String message = String.format("Fail to read template file: %s with error: %s", templatePath, e.getMessage());
                            LOGGER.error(message);
                            throw new TemplateLoaderException(message);
                        }
                        templateCache.put(templateIdentifier, templateContentData);
                    }
                    return Optional.of(templateContentData);
                }
            } catch (URISyntaxException e) {
                String message = String.format("Cannot get valid URI for template file path: %s with error: %s", templatePath, e.getMessage());
                LOGGER.error(message);
                throw new TemplateLoaderException(message);
            }
        }
        String message = String.format("Cannot find template file: %s given directory path: %s and file extension: %s, returning empty.",
                responseTemplateName, directoryPath, fileExtension);
        LOGGER.warn(message);
        return Optional.empty();
    }