Redirect to an object's page based on a content-type ID and an object ID.
498044
def view_on_site(self, request, content_type_id, object_id):
        
        # Look up the object, making sure it's got a get_absolute_url() function.
        try:
            content_type = ContentType.objects.get(pk=content_type_id)
            if not content_type.model_class():
                raise Http404(_("Content type %(ct_id)s object has no associated model") % {
                    'ct_id': content_type_id,
                })
            obj = content_type.get_object_for_this_type(pk=object_id)
        except (ObjectDoesNotExist, ValueError):
            raise Http404(_("Content type %(ct_id)s object %(obj_id)s doesn't exist") % {
                'ct_id': content_type_id,
                'obj_id': object_id,
            })

        try:
            get_absolute_url = obj.get_absolute_url
        except AttributeError:
            raise Http404(_("%(ct_name)s objects don't have a get_absolute_url() method") % {
                'ct_name': content_type.name,
            })
        absurl = get_absolute_url()

        return HttpResponseRedirect(absurl)
247198
function (req, bucket, content) {
                var location = getLocation(req),
                    href = location.origin;
                
                // If the objectKey is a folder we want to get a url to the bucket with a prefix param
                if (content.Key.substr(-1) === '/' && content.Size === 0) {
                    // Merge marker property with existing queries
                    location.search = getMergedSearch(req.query, {
                        prefix: encodeURI(content.Key)
                    });
                    href += location.search;
                } else {
                // Since we are getting a link for an item the href must end with slash
                    if (href.substr(-1) !== '/') {
                        href += '/';
                    }
                    href += encodeURI(content.Key);
                }
                
                return href;
            }
86550
def __load(self, redirect=True, preload=False):
    '''
    
    '''
    query_params = {
      'prop': 'info|pageprops',
      'inprop': 'url',
      'ppprop': 'disambiguation',
      'redirects': '',
    }
    if not getattr(self, 'pageid', None):
      query_params['titles'] = self.title
    else:
      query_params['pageids'] = self.pageid

    request = _wiki_request(query_params)

    query = request['query']
    pageid = list(query['pages'].keys())[0]
    page = query['pages'][pageid]

    # missing is present if the page is missing
    if 'missing' in page:
      if hasattr(self, 'title'):
        raise PageError(self.title)
      else:
        raise PageError(pageid=self.pageid)

    # same thing for redirect, except it shows up in query instead of page for
    # whatever silly reason
    elif 'redirects' in query:
      if redirect:
        redirects = query['redirects'][0]

        if 'normalized' in query:
          normalized = query['normalized'][0]
          assert normalized['from'] == self.title, ODD_ERROR_MESSAGE

          from_title = normalized['to']

        else:
          from_title = self.title

        assert redirects['from'] == from_title, ODD_ERROR_MESSAGE

        # change the title and reload the whole object
        self.__init__(redirects['to'], redirect=redirect, preload=preload)

      else:
        raise RedirectError(getattr(self, 'title', page['title']))

    # since we only asked for disambiguation in ppprop,
    # if a pageprop is returned,
    # then the page must be a disambiguation page
    elif 'pageprops' in page:
      query_params = {
        'prop': 'revisions',
        'rvprop': 'content',
        'rvparse': '',
        'rvlimit': 1
      }
      if hasattr(self, 'pageid'):
        query_params['pageids'] = self.pageid
      else:
        query_params['titles'] = self.title
      request = _wiki_request(query_params)
      html = request['query']['pages'][pageid]['revisions'][0]['*']

      lis = BeautifulSoup(html, 'html.parser').find_all('li')
      filtered_lis = [li for li in lis if not 'tocsection' in ''.join(li.get('class', []))]
      may_refer_to = [li.a.get_text() for li in filtered_lis if li.a]

      raise DisambiguationError(getattr(self, 'title', page['title']), may_refer_to)

    else:
      self.pageid = pageid
      self.title = page['title']
      self.url = page['fullurl']
907901
def page_for_url(cls, url):
        """"""
        resp, elem = Resource.element_for_url(url)

        value = Resource.value_for_element(elem)

        return cls.page_for_value(resp, value)
13267
function(url, paramsObj) {
    if(!paramsObj || typeof paramsObj !== "object") {
        return url;
    }
    
    _.each(_.keys(paramsObj), function(paramName) {
        var string = paramsObj[paramName];
        if (typeof string === 'object') {
            string = JSON.stringify(string);
        }
        url = addParam(url, encodeURIComponent(paramName), encodeURIComponent(string));
    });
    
    return url;
}
1357111
def get_foreign_page_id_from_type(self, page_type):
        '''
        
        '''
        # TODO: log this
        response = requests.get("{}pages/?type={}".format(
            self.api_url, page_type))
        content = json.loads(response.content)
        return content["items"][0]["id"]
817607
def get_content_object_url(self):
        """"""
        if (self.content_object and
            hasattr(self.content_object, 'get_absolute_url')):
            return self.content_object.get_absolute_url()

        return None
556613
function BasePage(url, id, _options) {
                var _this = _super.call(this, url, id, _options = $.extend({
                    baseHeader: UI.BaseHeaderView,
                    backCommandHandler: "onPageBack",
                    backCommandKind: "pageback",
                    domExtensionOptions: {},
                }, _options)) || this;
                _this._options = _options;
                return _this;
            }
1339768
protected <T extends AppController> HttpBuilder redirect(Class<T> controllerClass, Object id){
        return redirect(controllerClass, map("id", id));
    }
986913
function (urlpath, dirs) {
    dirs.forEach(function (val, idx) {
        redirectTo(urlpath, false);
        addDeepDir(urlpath, val);
    });
}
917363
function redirect(url) {
    var path = u.urlPath(url);
    var params = u.urlParams(url);

    var pg = generator.aliase$[path];
    if (pg) return { status:301, url:pg._href + params };

    pg = generator.redirect$[path];
    if (pg) return { status:302, url:pg._href + params };

    // customRedirects return params also
    pg = generator.customRedirect && generator.customRedirect(url);
    if (pg) return { status:301, url:pg };
  }
111114
function redirectTo(route, params, options) {
		middleware.resolution.reject({
			type: "redirectTo",
			route: route,
			params: params,
			options: options
		});
	}
728526
def get_object(self, id, **args):
        """"""
        return self.request("{0}/{1}".format(self.version, id), args)
652834
def redirect_ext(to, params_=None, anchor_=None, permanent_=False, args=None, kwargs=None):
    
    if permanent_:
        redirect_class = HttpResponsePermanentRedirect
    else:
        redirect_class = HttpResponseRedirect
    return redirect_class(resolve_url_ext(to, params_, anchor_, args, kwargs))
937134
function reopenObject( $id )
    {
        $this->nStack++;
        $this->stack[$this->nStack] = array( 'c' => $this->currentContents,
                                             'p' => $this->currentPage );
        $this->currentContents=$id;
        // also if this object is the primary contents for a page, then set the current page to its parent
        if ( isset( $this->objects[$id]['onPage'] ) )
        {
            $this->currentPage = $this->objects[$id]['onPage'];
        }
    }
319018
function getReqObj(url, obj){
  if(typeof url === 'object') return url;
  else {
    obj = {}
    obj.url = url
    return obj
  }
}
850261
def dynamic_content_item_show(self, id, **kwargs):
        ""
        api_path = "/api/v2/dynamic_content/items/{id}.json"
        api_path = api_path.format(id=id)
        return self.call(api_path, **kwargs)