def _register_services(uri): new_templates = {} tree = amara.parse(uri) for path in tree.xml_select("//service[@ident]/path[@template]"): ident = path.xml_parent.xml_attributes["ident"] template = path.xml_attributes["template"] new_templates[ident] = opensearch.make_template(template) return new_templates
def internal_template(self): if self._internal_template is False: # No template is possible return None if self._internal_template is not None: # Cached version return self._internal_template # Compute the template if self.query_template is None: # No template available self._internal_template = False return None internal_template = global_config.internal_server_root + self.query_template self._internal_template = opensearch.make_template(internal_template) return self._internal_template
def register_template(ident, template): if isinstance(template, basestring): template = opensearch.make_template(template) _registered_templates[ident] = template