def _lookup_skin(name, template): if name.startswith('/'): return component.getUtility(ISkinObject, name=name[1:]) if not ISkinObject.providedBy(template): raise TypeError( "Relative lookup for '%s' invalid for template class: %s." % ( name, type(template))) path = '/' + template.name while path: inst = component.queryUtility(ISkinObject, name="%s/%s" % (path[1:], name)) if inst is not None: return inst path = path[:path.rindex('/')] return component.getUtility(ISkinObject, name=name)
def lookup_skin(template, name): request = get_current_request() name = name.strip() if name.startswith("/"): return _lookup_component(request, name[1:]) assert ISkinObject.providedBy(template) path = "/" + template.name while path: try: return _lookup_component(request, "%s/%s" % (path[1:], name)) except ComponentLookupError: pass path = path[: path.rindex("/")] return _lookup_component(request, name)
def lookup_skin(template, name): request = get_current_request() name = name.strip() if name.startswith('/'): return _lookup_component(request, name[1:]) assert ISkinObject.providedBy(template) path = '/' + template.name while path: try: return _lookup_component(request, "%s/%s" % (path[1:], name)) except ComponentLookupError: pass path = path[:path.rindex('/')] return _lookup_component(request, name)