I surely this is bug in nightly version webhelpers
I fixed it by modify  links.py
see the attachment


2008/4/5 张沈鹏(电子科大 毕/就业倒计时...) <[EMAIL PROTECTED]>:
> from webhelpers.pagination import paginate,links
>
>     def feed(self,id,page):
>         c.feed=Feed.query.filter_by(id=id).one()
>         c.feeds=c.feed.site.feeds
>         paginator,c.posts=paginate(c.feed.posts,int(page),30)
>         c.links=links.pagelist(paginator.current)
>         return render("news/feed.htm")
>
>
>
>  On Sat, Apr 5, 2008 at 1:47 PM, Mike Orr <[EMAIL PROTECTED]> wrote:
>  > 2008/4/4 张沈鹏(电子科大 毕/就业倒计时...) <[EMAIL PROTECTED]>:
>  >
>  > > see picture in attachment
>  >  >
>  >  >   when I click 0 the links is 01...2345
>  >  >   when I click 1-4 the links is 0123
>  >  >   when I click 5 the links is 0123...45
>  >
>  >  Is this webhelpers.pagination or webhelpers.paginate?  Paginate is the
>  >  new one.  Pagination is deprecated.  I don't know about your problem,
>  >  though I've never done it starting at page 0 before.  I always start
>  >  at 1.
>  >
>  >  --
>  >  Mike Orr <[EMAIL PROTECTED]>
>  >
>  >  >  >
>  >
>
>
>
>  --
>
>
> 博客:http://zsp.javaeye.com/
>  个人网站:http://zsp007.com.cn/
>  电子科大,7月就要毕业了,何去何从...
>  双学位:生物医学工程+计算机科学与技术
>   -- 张教主
>



-- 
Blog(Chinese Edition):
 http://zsp.javaeye.com/
Resume(Also Chinese):
 http://zsp007.com.cn/
Where graduate soon , where to go ......
Double major:
 Biomedical Engineering
 Computer Science
 -- Hierarch Zhang

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---

"""Pagination Link Generators - Deprecated: Use paginate."""
"""Modify By ZhangShen Peng 2008-4-6 16:17,Email:[EMAIL PROTECTED]"""
from webhelpers.htmlgen import html

def pagelist(page,padding=3):
    """PHPbb style Pagination Links - return HTML to be included in page. 
    
    The html source is generated with htmlgen.
    
    """
    paginator = page.paginator

    first_page = paginator[0]
    first_window = first_page.window(padding=padding)

    page_window = page.window(padding=1)

    last_page = paginator[-1]
    last_window = last_page.window(padding=padding)

    if int(last_window.last)-int(first_window.first)<=2*(padding+2):
        #012...456 is not good than 0123456
        first_window.last = last_window.last
        display =first_window.pages
    elif int(first_window.last)+2 >= int(page_window.first):
        if page_window.last>first_window.last:
            first_window.last = page_window.last
        display = (first_window.pages + [None] + last_window.pages)
    elif int(page_window.last)+2 >= int(last_window.first):
        if page_window.first<last_window.first:
            last_window.first = page_window.first
        display = (first_window.pages + [None] + last_window.pages)
    else:
        display = (first_window.pages + [None] + page_window.pages + [None]
                        + last_window.pages)

    pager_c = []
    for i in display:
        if i is None:
            pager_c.append(html.span(c='...'))
        elif i == page:
            pager_c.append(html.span(c=[i]))
        else:
            pager_c.append(html.a(href=i, c=[i]))

    pager = html.div(class_='pager', c=pager_c)

    return pager

Reply via email to