Run a string through pager
177618
def show_in_pager(self, strng, *args, **kwargs):
    
    # On PyDev we just output the string, there are scroll bars in the console
    # to handle "paging". This is the same behaviour as when TERM==dump (see
    # page.py)
    # for compatibility with mime-bundle form:
    if isinstance(strng, dict):
        strng = strng.get('text/plain', strng)
    print(strng)
454069
public static double call(PageContext pc, String strFilter) throws PageException {
	return _call(pc, strFilter, null);
    }
1169901
function getdata($page = 1, $length = 10, $ano = false, $mes = false, $dia = false)
    {
        
        $dt = [];
        $where = '';
        
        if ($ano !== false) {
            $where .= ' AND YEAR(data) = :ano ';
            $dt[':ano'] = $ano;
        }
        
        if ($mes !== false) {
            $where .= ' AND MONTH(data) = :mes ';
            $dt[':mes'] = $mes;
        }

        if ($dia !== false) {
            $where .= ' AND DAY(data) = :dia ';
            $dt[':dia'] = $dia;
        }

        //Calculando a página
        $data = $this->calculate($page, $length,
                                'SELECT id								 
								 FROM access								 
								 WHERE (uri LIKE "/a/%" 
								 OR uri = "/")
								 '.$where.'								 
								 GROUP BY uri, MONTH(data), DAY(data)', $dt);

        return $this->execute($data,
                                'SELECT data, COUNT(id)qt, uri AS Link 
								 FROM access
     							 WHERE (uri LIKE "/a/%" 
								 OR uri = "/")
								 '.$where.'
								 GROUP BY uri, MONTH(data), DAY(data)
								 ORDER BY DAY(data), uri
								 LIMIT '.$data['init'].', '.$data['length'], $dt);
    }
1362666
def handle_data(self, data):
        """"""
        if not self.silent:
            if self.url:
                if self.url == data:
                    data = ''
                else:
                    data = '(' + data + ')'
            self.url = ''
            self.result += cgi.escape(data, True)
        lines = data.splitlines()
        if len(lines) > 1:
            match_obj = RE_HTML_FIRST_NON_QUOTATION_CHAR_ON_LINE.search(
                lines[-1])
            if match_obj:
                self.line_quotation = '&gt;' * match_obj.start()
            else:
                self.line_quotation = ''
96442
def get_page_from_string_or_id(page_string, lang=None):
    """"""
    if type(page_string) == int:
        return Page.objects.get(pk=int(page_string))
    # if we have a string coming from some templates templates
    is_text = isinstance(page_string, SafeText)
    import sys
    PY3 = sys.version > '3'
    if PY3:
        is_string = isinstance(page_string, str)
    else:
        is_string = isinstance(page_string, unicode) or isinstance(page_string, str)
    if is_text or is_string:
        if page_string.isdigit():
            return Page.objects.get(pk=int(page_string))
        return Page.objects.from_path(page_string, lang)
    # in any other case we return the input becasue it's probably
    # a Page object.
    return page_string
297568
def run(string)
      string = string.to_s
      if ltr_characters?(string) && rtl_characters?(string)
        bidi
      elsif ltr_characters?(string)
        ltr
      elsif rtl_characters?(string)
        rtl
      end
    end
174582
public static boolean call(PageContext pc, String str) {

	try {
	    return pc.evaluate(str) == null;
	}
	catch (PageException e) {
	    return true;
	}
    }
1120127
def _run_search_request(
            self, protocol_request, object_name, protocol_response_class):
        
        not_done = True
        while not_done:
            response_object = self._run_search_page_request(
                protocol_request, object_name, protocol_response_class)
            value_list = getattr(
                response_object,
                protocol.getValueListName(protocol_response_class))
            for extract in value_list:
                yield extract
            not_done = bool(response_object.next_page_token)
            protocol_request.page_token = response_object.next_page_token
1053779
def paginate(url, options = {}, &block)
      opts = options.dup
      if @auto_paginate || @per_page
        opts[:query] ||= {}
        opts[:query][:per_page] ||= @per_page || (@auto_paginate ? MAX_PER_PAGE : nil)
      end

      data = request(:get, url, nil, opts)

      if @auto_paginate
        while @last_response.rels[:next]
          @last_response = @last_response.rels[:next].get(headers: opts[:headers])
          if block_given?
            yield(data, @last_response)
          else
            data.concat(@last_response.data) if @last_response.data.is_a?(Array)
          end
        end
      end

      data
     end
1171226
def run(string)
      string = string.to_s
      if ltr_mark?(string) && rtl_mark?(string)
        bidi
      elsif ltr_mark?(string)
        ltr
      elsif rtl_mark?(string)
        rtl
      end
    end
376141
function (e) {
        var t = YAHOO.util.Event.getTarget(e);
        if (t && YAHOO.util.Dom.hasClass(t,
                        this.paginator.get('pageLinkClass'))) {

            YAHOO.util.Event.stopEvent(e);

            this.paginator.setPage(parseInt(t.getAttribute('page'),10));
        }
    }
370788
def execute_once(self, string):
        """"""
        for rule in self.rules:
            if rule[0] in string:
                pos = string.find(rule[0])
                self.last_rule = rule
                return string[:pos] + rule[1] + string[pos+len(rule[0]):]
        self.last_rule = None
        return string
1185285
function (pageNum) {
            var textPath = util.template(config.template.html, { page: pageNum });
            return config.url + textPath + config.queryString;
        }
1254589
def pagination_for(context, current_page, page_var="page", exclude_vars=""):
    
    querystring = context["request"].GET.copy()
    exclude_vars = [v for v in exclude_vars.split(",") if v] + [page_var]
    for exclude_var in exclude_vars:
        if exclude_var in querystring:
            del querystring[exclude_var]
    querystring = querystring.urlencode()
    return {
        "current_page": current_page,
        "querystring": querystring,
        "page_var": page_var,
    }
452210
public static String call(PageContext pc, Object object) throws PageException {
	return call(pc, object, null, true, 9999, null, null, null, null, 9999, true, true);
    }
226380
private void updatePaginationState(final SimplePager pager) {

        for (int i = 0; i < getWidgetCount(); i++) {
            if (i == 0) { //previous button
                ((AnchorListItem)getWidget(i)).setEnabled(pager.hasPreviousPage());
            }
            else if (i == getWidgetCount() - 1) { //next button
                ((AnchorListItem)getWidget(i)).setEnabled(pager.hasNextPage());
            }
            else {
                int index = i - 1;
                if (index == pager.getPage()) {
                    ((AnchorListItem)getWidget(i)).setActive(true);
                }
                else {
                    ((AnchorListItem)getWidget(i)).setActive(false);
                }
            }
        }
   }
22532
def paginate(self, skip, limit):
        """"""
        if not self.count() or not limit:
            return
        skip = skip or 0
        pages = int(ceil(self.count() / float(limit)))
        limits = {}
        last = 0
        for i in range(pages):
            current = limit * i
            limits[last] = current
            last = current
        # example with count == 62
        # {0: 20, 20: 40, 40: 60, 60: 62}
        if limit and limit < self.count():
            limit = limits.get(skip, self.count())
            self.cursordat = self.cursordat[skip: limit]