Thanks Michael,

What I finally did was to override the class.

I was looking a way to use the pagination styles from the bootstrap library 
(http://twitter.github.com/bootstrap/components.html#pagination) 
to accomplish that I would need to paginate.pager return me a '<li> list of 
link to pages' .

This is the patch

--- 
../tg2.1.5env/lib/python2.7/site-packages/WebHelpers-1.3-py2.7.egg/webhelpers/paginate.py
 2012-04-27 
21:44:36.000000000 -0500
+++ myapp/lib/paginate.py 2012-07-14 00:37:19.000000000 -0500
@@ -504,7 +504,7 @@
         show_if_single_page=False, separator=' ', onclick=None,
         symbol_first='<<', symbol_last='>>',
         symbol_previous='<', symbol_next='>',
-        link_attr={'class':'pager_link'}, 
curpage_attr={'class':'pager_curpage'},
+        link_attr={'class':'pager_link'}, curpage_attr={'class':'active'},
         dotdot_attr={'class':'pager_dotdot'}, **kwargs):
         """
         Return string with links to other pages (e.g. "1 2 [3] 4 5 6 7").
@@ -748,7 +748,9 @@
         # Create a link to the first page (unless we are on the first page
         # or there would be no need to insert '..' spacers)
         if self.page != self.first_page and self.first_page < 
leftmost_page:
-            nav_items.append( self._pagerlink(self.first_page, 
self.first_page) )
+            text = self._pagerlink(self.first_page, self.first_page)
+            ltext = HTML.li(text)
+            nav_items.append( ltext )
 
         # Insert dots if there are pages between the first page
         # and the currently displayed page range
@@ -756,8 +758,9 @@
             # Wrap in a SPAN tag if nolink_attr is set
             text = '..'
             if self.dotdot_attr:
-                text = HTML.span(c=text, **self.dotdot_attr)
-            nav_items.append(text)
+                text = HTML.a(text, href='#')
+                ltext = HTML.li(text, **self.curpage_attr)
+            nav_items.append(ltext)
 
         for thispage in xrange(leftmost_page, rightmost_page+1):
             # Hilight the current page number and do not use a link
@@ -765,12 +768,14 @@
                 text = '%s' % (thispage,)
                 # Wrap in a SPAN tag if nolink_attr is set
                 if self.curpage_attr:
-                    text = HTML.span(c=text, **self.curpage_attr)
-                nav_items.append(text)
+                    text = HTML.a(text, href='#')
+                    ltext = HTML.li(text, **self.curpage_attr)
+                nav_items.append(ltext)
             # Otherwise create just a link to that page
             else:
                 text = '%s' % (thispage,)
-                nav_items.append( self._pagerlink(thispage, text) )
+                ltext = self._pagerlink(thispage, text)
+                nav_items.append( HTML.li(ltext) )
 
         # Insert dots if there are pages between the displayed
         # page numbers and the end of the page range
@@ -778,14 +783,19 @@
             text = '..'
             # Wrap in a SPAN tag if nolink_attr is set
             if self.dotdot_attr:
-                text = HTML.span(c=text, **self.dotdot_attr)
-            nav_items.append(text)
+                text = HTML.a(text, href='#')
+                ltext = HTML.li(text, **self.curpage_attr)
+            nav_items.append(ltext)
 
         # Create a link to the very last page (unless we are on the last
         # page or there would be no need to insert '..' spacers)
         if self.page != self.last_page and rightmost_page < self.last_page:
             nav_items.append( self._pagerlink(self.last_page, 
self.last_page) )

>
>

On Sunday, July 15, 2012 12:14:25 AM UTC-5, Michael Pedersen wrote:
>
> Well, thinking about it, you have a few options.
>
> You can override the class, and set the static template. Nothing wrong 
> with this, and could even be preferred, especially on higher traffic sites. 
> It will only ever be handled once, and it's done.
>
> You can add your logic to your base controller (look at 
> myproject.lib.base:BaseController). That method would work, but will incur 
> an overhead on *every* request to your site. Small, but still there.
>
> You can continue as you have been, adding your logic to each controller 
> method. Not very maintainable, and still incurs the penalty.
>
> You can re-check and make sure you actually need to be doing this. Most 
> people, most of the time, should be able to get along with just updating 
> their CSS files, resulting in no changes at all. This is the best, but is 
> not always something that can be done. If you can, though, I would 
> recommend it.
>
> That's really all the options I can come up with. I hope it helps somewhat.
>
> On Fri, Jul 13, 2012 at 10:25 PM, Juparave <[email protected]> wrote:
>
>> Hello,
>>>
>>> I wonder where exactly should I set flash.static_template.
>>
>> I want to change the template site-wide and so far what I manage to do is 
>> to add a declaration for flash.static_template in every controller.
>>
>> Should I override the class and set the static_template there?
>>
>> Thanks, I know is an old issue but so far google hasn't been my friend on 
>> this.
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "TurboGears" group.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msg/turbogears/-/UWw2OeNbdvcJ.
>> 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/turbogears?hl=en.
>>
>
>
>
> -- 
> Michael J. Pedersen
> My Online Resume: http://www.icelus.org/ -- Google+ 
> http://plus.ly/pedersen
> Google Talk: [email protected] -- Twitter: pedersentg
>
>  

-- 
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/turbogears/-/q3Ii_diIGQMJ.
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/turbogears?hl=en.

Reply via email to