Make regex string for ``PluggableSite`` urlpatterns: prepend url
            with parent object's url and app name.

            See also: http://code.djangoproject.com/ticket/11559.
971044
def make_regex(self, url):
        '''
            
        '''
        return r"^%s/%s%s$" % (self.object_getter.regex, self.app_name, url)
252997
def site_url(self, url):
        
        # Regular expression to URL validate
        regex = re.compile(
            r'^(?:http|https)://'  # Scheme only HTTP/HTTPS
            r'(?:(?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\.)+(?:[A-Z]{2,6}\.?| \
            [A-Z0-9-]{2,}(?<!-)\.?)|'  # Domain
            r'localhost|'  # localhost...
            r'\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}|'  # or ipv4
            r'\[?[A-F0-9]*:[A-F0-9:]+\]?)'  # or ipv6
            r'(?::\d+)?'  # Port
            r'(?:/?|[/?]\S+)$', re.IGNORECASE)

        # Validate URL
        if re.match('^(?:http|https)://', url):
            if re.search(regex, url):
                self.__site_url = url
            else:
                raise PybooruError("Invalid URL: {0}".format(url))
        else:
            raise PybooruError(
                "Invalid URL scheme, use HTTP or HTTPS: {0}".format(url))
463094
def bind_extensions(app):
    
    # bind plugin to app object
    app.db = app.config['PUZZLE_BACKEND']
    app.db.init_app(app)

    # bind bootstrap blueprints
    bootstrap.init_app(app)
    markdown(app)

    @app.template_filter('islist')
    def islist(object):
        return isinstance(object, (tuple, list))
1328012
function isAnchorTagApplied({ result, plugins = [] }, { regex }) {
  return (
    getAnchorRegex(regex).test(result) ||
    plugins.filter(plugin => plugin.id === "url").length
  )
}
1061984
def gen_url_name(resource):
    "  "

    if resource._meta.parent:
        yield resource._meta.parent._meta.url_name

    if resource._meta.prefix:
        yield resource._meta.prefix

    for p in resource._meta.url_params:
        yield p

    yield resource._meta.name
53062
function normalizeUrl(url, options)
{
	var portSuffix;
	url = parseUrl(url, options);
	
	// Remove default port
	if (url.extra.portIsDefault===true && url.port!==null)
	{
		if (isString(url.host) === true)
		{
			portSuffix = ":" + url.port;
			
			// Remove ":123" suffix from host
			if (url.host.substr(-portSuffix.length) === portSuffix)
			{
				url.host = url.host.slice(0, -portSuffix.length);
			}
		}
		
		url.port = null;
	}
	
	url.extra.directory = normalizeDirs(url.extra.directory, url.extra.directoryLeadingSlash).dir;
	
	url.pathname = formatPathname(url);
	
	// Remove empty query
	if (url.search === "?")
	{
		url.search = null;
		
		if (url.query==="?" || url.query==="") url.query = null;
	}
	
	// TODO :: remove empty hashes ("path#") ?
	
	url.path = formatPath(url);
	
	url.href = urllib.format(url);
	
	return url;
}
1318862
def get_pattern_formatter(cls, location):
        
        pattern = ''
        formatter = ''
        canon = ''
        for part in cls.ROUTE_RE.split(location):
            match = cls.DYN.match(part)
            if match:
                pattern += '(?P<{}>{})'.format(match.group('var'), cls.GOOD)
                formatter += '{' + match.group('var') + '}'
                continue

            match = cls.DYN_WITH_RE.match(part)
            if match:
                pattern += '(?P<{var}>{re})'.format(**match.groupdict())
                formatter += '{' + match.group('var') + '}'
                canon += match.group('re')
                continue

            if '{' in part or '}' in part:
                raise ValueError("Invalid path '{}'['{}']".format(
                    location, part))

            formatter += part
            pattern += re.escape(part)
            canon += part

        try:
            return re.compile(pattern), formatter, canon
        except re.error as exc:
            raise ValueError(
                "Bad pattern '{}': {}".format(pattern, exc)) from None
1106949
function LocationUrl(url, pathPrefix, appBaseUrl) {
  pathPrefix = pathPrefix || '';

  /**
   * Parse given html5 (regular) url string into properties
   * @param {string} newAbsoluteUrl HTML5 url
   * @private
   */
  this.$$parse = function(newAbsoluteUrl) {
    var match = matchUrl(newAbsoluteUrl, this);

    if (match.path.indexOf(pathPrefix) !== 0) {
      throw Error('Invalid url "' + newAbsoluteUrl + '", missing path prefix "' + pathPrefix + '" !');
    }

    this.$$path = decodeURIComponent(match.path.substr(pathPrefix.length));
    this.$$search = parseKeyValue(match.search);
    this.$$hash = match.hash && decodeURIComponent(match.hash) || '';

    this.$$compose();
  };

  /**
   * Compose url and update `absUrl` property
   * @private
   */
  this.$$compose = function() {
    var search = toKeyValue(this.$$search),
        hash = this.$$hash ? '#' + encodeUriSegment(this.$$hash) : '';

    this.$$url = encodePath(this.$$path) + (search ? '?' + search : '') + hash;
    this.$$absUrl = composeProtocolHostPort(this.$$protocol, this.$$host, this.$$port) +
                    pathPrefix + this.$$url;
  };


  this.$$rewriteAppUrl = function(absoluteLinkUrl) {
    if(absoluteLinkUrl.indexOf(appBaseUrl) == 0) {
      return absoluteLinkUrl;
    }
  }


  this.$$parse(url);
}
754933
def _parse_url_and_validate(cls, url):
        
        parsed_url = urlparse(url)
        if parsed_url.scheme and parsed_url.netloc:
            final_url = parsed_url.geturl()
        else:
            raise BadURLException
        return final_url
686184
def static_urls_js():
    
    if apps.is_installed('django.contrib.staticfiles'):
        from django.contrib.staticfiles.storage import staticfiles_storage
        static_base_url = staticfiles_storage.base_url
    else:
        static_base_url = PrefixNode.handle_simple("STATIC_URL")
    transpile_base_url = urljoin(static_base_url, 'js/transpile/')
    return {
        'static_base_url': static_base_url,
        'transpile_base_url': transpile_base_url,
        'version': LAST_RUN['version']
    }
376816
def path_regex(self):
        """"""
        build_dir = 'try-%(PLATFORM)s%(DEBUG)s/' % {
            'PLATFORM': self.platform_regex,
            'DEBUG': '-debug' if self.debug_build else ''}
        return urljoin(self.build_list_regex,
                       self.builds[self.build_index],
                       build_dir)
60574
private String prependSiteRoot(String url) {

        String site = getCms().getRequestContext().getSiteRoot();
        if (CmsStringUtil.isEmptyOrWhitespaceOnly(site) || OpenCms.getSiteManager().isSharedFolder(site)) {
            site = OpenCms.getSiteManager().getDefaultUri();
            if (CmsStringUtil.isEmptyOrWhitespaceOnly(site)
                || (OpenCms.getSiteManager().getSiteForSiteRoot(site) == null)) {
                return OpenCms.getSiteManager().getWorkplaceServer() + url;
            } else {
                return OpenCms.getSiteManager().getSiteForSiteRoot(site).getUrl() + url;
            }
        }
        return OpenCms.getSiteManager().getSiteForSiteRoot(site).getUrl() + url;
    }
237399
def prepend_http(url):
    
    url = url.lstrip()
    if not urlparse(url).scheme:
        return 'http://' + url
    return url
635816
def configure_urls(apps, index_view=None, prefixes=None):
    '''
    
    '''
    prefixes = prefixes or {}
    urlpatterns = patterns('')

    if index_view:
        from django.views.generic.base import RedirectView
        urlpatterns += patterns('',
            url(r'^$', RedirectView.as_view(pattern_name=index_view, permanent=False)),
        )

    for app_name in apps:
        app_module = importlib.import_module(app_name)
        if module_has_submodule(app_module, 'urls'):
            module = importlib.import_module("%s.urls" % app_name)
            if not hasattr(module, 'urlpatterns'):
                # Resolver will break if the urls.py file is completely blank.
                continue
            app_prefix = prefixes.get(app_name, app_name.replace("_","-"))
            urlpatterns += patterns(
                '',
                url(
                    r'^%s/' % app_prefix if app_prefix else '',
                    include("%s.urls" % app_name),
                ),
            )


    return urlpatterns
751415
def _urls(self):
        
        info = (
            self.model._meta.app_label, self.model._meta.model_name,
            self.name,
        )
        urlpatterns = [
            url(r'^%s/$' % self.name, self._view, name='%s_%s_%s' % info)
        ]
        return urlpatterns
1267543
function vhostof (req, regexp) {
  var host = req.headers.host
  var hostname = hostnameof(req)

  if (!hostname) {
    return
  }

  var match = regexp.exec(hostname)

  if (!match) {
    return
  }

  var obj = Object.create(null)

  obj.host = host
  obj.hostname = hostname
  obj.length = match.length - 1

  for (var i = 1; i < match.length; i++) {
    obj[i - 1] = match[i]
  }

  return obj
}
608621
function buildUrl(path, search) {
    return Object.keys(search).length ? path + '?' + qs.stringify(search) : path;
  }