<%page args="module"/> <% import os.path import splunk.util from formencode.validators import URL src = module['src'] check_exists = splunk.util.normalizeBoolean(module['check_exists']) error = None if src.startswith(('http://', 'https://')): u = URL(add_http=False, check_exists=check_exists) try: u.to_python(src) except Exception, e: error = e elif src.startswith('/'): src = make_url(src) else: if check_exists and not os.path.exists(os.path.join(os.environ['SPLUNK_HOME'], 'etc', 'apps', APP['id'], 'appserver', 'static', src)): error = "File does not exist" src = make_url('/static/app/%s/%s' % (APP['id'], src)) %> % if error: ${error} % else: % endif