Re: WebHelpers 0.6 released
Previously Ian Bicking wrote: Christoph Haas wrote: On Freitag, 11. Juli 2008, Mike Orr wrote: On Fri, Jul 11, 2008 at 9:43 AM, rcs_comp [EMAIL PROTECTED] wrote: in html.tags the form function has 'POST' for the default method, which is invalid xhtml. I changed it to: def form(url, method=post,... and all is well. Is it really? Does the browser convert it to POST before sending the HTTP request? Just want to make sure I don't break anything before lowercasing it (and all the other methods in the function). I second rcs_comp (/me donates his parent a few bucks to give him a real name). I use method='post' everywhere in my code because uppercase attributes aren't xhtml'ish. That reminds me that I wanted to open a ticket for that one. :) Uppercase attribute... values? What does XHTML care about the values? Apparently the DTD does specify lower-case values. XHTML is totally nutty. I asked a designer friend of mine recently why he preferred XHTML over HTML. He had a whole set of reasons (paraphrased and translated from Dutch): 1. XHTML = XML, which makes transformation from XML to XHTML with, for example, XSLT much simpler. 2. XHTML is consistent: all tags are closed instead. Unlike HTML, which is very inconsistent and thus harder to deal with. An important aspect here is that parent vs child relations in XHTML are always clear, which is critical when styling content. 4. XHTML works on all browsers and is downwards compatible with ancient browsers, so no reason not to use it. 5. XHTML supports JavaScript DOM manipulation much better 6. XHTML can be parsed by both javascript and server side-parsers as XML which makes it easy to process. Some JavaScript parsers can not handle old HTML at all 7. There no reason not to use XHTML. Wichert. -- Wichert Akkerman [EMAIL PROTECTED]It is simple to make things. http://www.wiggy.net/ It is hard to make things simple. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com 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 -~--~~~~--~~--~--~---
Re: WebHelpers 0.6 released
On Freitag, 11. Juli 2008, Ian Bicking wrote: Christoph Haas wrote: I use method='post' everywhere in my code because uppercase attributes aren't xhtml'ish. That reminds me that I wanted to open a ticket for that one. :) Uppercase attribute... values? What does XHTML care about the values? Apparently the DTD does specify lower-case values. XHTML is totally nutty. Yes, values. I wonder why some people seem to be so upset about XHTML. Not that I think XML is suited well for everything or especially human-readable. But in the HTML context it makes sense to close tags properly. And I don't see why anything should be uppercase anyway. This ain't AOL. @Mike: it's just cosmetic. But I think we agreed to let Webhelpers create XHTML. So it would be correct to use post instead of POST. That won't really break anything but help correct W3C verification. Kindly Christoph -- When you do things right people won't be sure you've done anything at all. signature.asc Description: This is a digitally signed message part.
Re: WebHelpers 0.6 released
On Tue, Jul 8, 2008 at 6:18 PM, Mike Orr [EMAIL PROTECTED] wrote: WebHelpers 0.6 final has been released. Just do: $ easy_install -U WebHelpers For now you'll have to read the docstrings in the source code for documentation. I'm hoping these will be included online in the Pylons 0.9.7 documentation as soon as that project is finished. Here's what's available online for now: http://docs.pylonshq.com/helpers.html There's a detailed howto for webhelpers.paginage, and a brief description of the rest of the package. Pylons 0.9.6 users using the stable version of WebHelpers should be able to upgrade as-is, although there's no particular benefit unless you want to start using the new (non-rails) helpers. You may have to add the following to helpers.py: from webhelpers.rails import * from routes import url_for from pylons.controllers.util import redirect_to We're trying to eliminate WebHelper's dependencies on Routes; that's the reason for the second two imports. Pylons 0.9.7-dev users who are using the rails helpers should add this to helpers.py: from webhelpers.rails.wrapped import * (And remove any other rails import, and add the url_for and redirect_to import above.) The ``wrapped`` module contains specially wrapped versions of all the rails helpers which will not be escaped by Pylons 0.9.7's default Mako filter. Otherwise you'll find escaped to lt; on your web pages. Users ready to upgrade from the rails helpers (which are all deprecated now) should see What's New in Pylons 0.9.7? for a list of suggested imports that are most similar to the rails helpers. The functions are similar but not always identical, so check the argument signature and function docstring. The biggest change is that the option order in webhelpers.html.tags.select() is the opposite of the old options_for_select(): value before label instead of label before value. There are tradeoffs both ways on this, but doing .items() on a dict whose keys are SELECT values seems more common than dicts whose keys are SELECT labels. All Javascript in WebHelpers has been deprecated, including Prototype, Scriptaculous, and link_to_remote(). We can't keep up with the rapid evolution of Javascript libraries, and the best one changes every six months. Several users have come up with short manual replacements to link_to_remote(), which you can ask about here or on IRC. Those wanting a comprehensive Javascript library can look at YUI, JQuery, ExtJS, ForkJavascript, etc. The rails helpers and Javascript stuff will be deleted in a future version of WebHelpers, so now is a good time to start migrating from them. Awesome I'm using tip for a while. and that was because of the decoupled routes, great more there. Today I sat down and wrote a patch to port simple_format to the new HTMLBuilder, I have created a ticket for it. feedback is welcome, and I hope it can be included in 0.6.1 or something. http://pylonshq.com/project/pylonshq/ticket/487 A simple question. - is there a way to prettify the HTML rendered by HTMLBuilder? like adding whitespace and indentation, for proper template placement? -- Mike Orr [EMAIL PROTECTED] --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com 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 -~--~~~~--~~--~--~---
Re: WebHelpers 0.6 released
On Sat, Jul 12, 2008 at 11:20 AM, Jorge Vargas [EMAIL PROTECTED] wrote: Today I sat down and wrote a patch to port simple_format to the new HTMLBuilder, I have created a ticket for it. feedback is welcome, and I hope it can be included in 0.6.1 or something. http://pylonshq.com/project/pylonshq/ticket/487 Thanks Jorge. To submit Mercurial patches, you make a bundle via hg bundle FILENAME.bundle That makes a file containing all your changesets that aren't on the server. The recipient clones their repository to make a test one, runs hg unbundle FILENAME.bundle to apply it, tests it, and if successful pushes the changes to their main repository. We do need a minimal format_paragraphs() helper. Markdown and Textile do this but they have a too high learning curve and too many features for many situations. Your function turns blank lines into paragraphs and puts a br / at other newlines. The one thing I would do is to add a flag to make the br /'s optional. If I've read a text file with line breaks, I don't want it putting br / on every line. Well, maybe I do, but maybe I don't? Is there anything else that should also go into a simple text-to-html formatter while we're at it? A simple question. - is there a way to prettify the HTML rendered by HTMLBuilder? like adding whitespace and indentation, for proper template placement? I don't think so. It doesn't know the current indentation level. It would probably be best to run HTML.tidy or BeautifulSoup on the complete webpage. This could be done in a middleware. -- Mike Orr [EMAIL PROTECTED] --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com 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 -~--~~~~--~~--~--~---
Re: WebHelpers 0.6 released
in html.tags the form function has 'POST' for the default method, which is invalid xhtml. I changed it to: def form(url, method=post,... and all is well. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com 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 -~--~~~~--~~--~--~---
Re: WebHelpers 0.6 released
On Fri, Jul 11, 2008 at 9:43 AM, rcs_comp [EMAIL PROTECTED] wrote: in html.tags the form function has 'POST' for the default method, which is invalid xhtml. I changed it to: def form(url, method=post,... and all is well. Is it really? Does the browser convert it to POST before sending the HTTP request? Just want to make sure I don't break anything before lowercasing it (and all the other methods in the function). -- Mike Orr [EMAIL PROTECTED] --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com 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 -~--~~~~--~~--~--~---
Re: WebHelpers 0.6 released
On Freitag, 11. Juli 2008, Mike Orr wrote: On Fri, Jul 11, 2008 at 9:43 AM, rcs_comp [EMAIL PROTECTED] wrote: in html.tags the form function has 'POST' for the default method, which is invalid xhtml. I changed it to: def form(url, method=post,... and all is well. Is it really? Does the browser convert it to POST before sending the HTTP request? Just want to make sure I don't break anything before lowercasing it (and all the other methods in the function). I second rcs_comp (/me donates his parent a few bucks to give him a real name). I use method='post' everywhere in my code because uppercase attributes aren't xhtml'ish. That reminds me that I wanted to open a ticket for that one. :) Christoph -- When you do things right people won't be sure you've done anything at all. signature.asc Description: This is a digitally signed message part.
Re: WebHelpers 0.6 released
Christoph Haas wrote: On Freitag, 11. Juli 2008, Mike Orr wrote: On Fri, Jul 11, 2008 at 9:43 AM, rcs_comp [EMAIL PROTECTED] wrote: in html.tags the form function has 'POST' for the default method, which is invalid xhtml. I changed it to: def form(url, method=post,... and all is well. Is it really? Does the browser convert it to POST before sending the HTTP request? Just want to make sure I don't break anything before lowercasing it (and all the other methods in the function). I second rcs_comp (/me donates his parent a few bucks to give him a real name). I use method='post' everywhere in my code because uppercase attributes aren't xhtml'ish. That reminds me that I wanted to open a ticket for that one. :) Uppercase attribute... values? What does XHTML care about the values? Apparently the DTD does specify lower-case values. XHTML is totally nutty. -- Ian Bicking : [EMAIL PROTECTED] : http://blog.ianbicking.org --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com 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 -~--~~~~--~~--~--~---
Re: WebHelpers 0.6 released
So are applications actually breaking with form method=POST ? Or is this an issue of formal correctness only? -- Mike Orr [EMAIL PROTECTED] --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com 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 -~--~~~~--~~--~--~---
Re: WebHelpers 0.6 released
Mike Orr wrote: So are applications actually breaking with form method=POST ? Or is this an issue of formal correctness only? Formal correctness of XHTML 1.0 strict only. Well, maybe if you serve your content as XHTML 1.0 strict the browser might barf on that. But if it does, it only barfs because you've asked it to. -- Ian Bicking : [EMAIL PROTECTED] : http://blog.ianbicking.org --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com 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 -~--~~~~--~~--~--~---
Re: WebHelpers 0.6 released
On Fri, Jul 11, 2008 at 1:09 PM, Ian Bicking [EMAIL PROTECTED] wrote: XHTML is totally nutty. I've been feeling better about XHTML since I started using DocBook. I'm quite glad there's a simple XSLT transformation from DocBook - XHTML to read the text without having to use a WYSIWYG editor (all of which seem to be commercial and/or Java). Converting to HTML 4 seems to be more problematic. Likewise, when I get tired of DocBook's verboseness, I think about making a XHTML - DocBook converter, which would be more difficult than going from HTML. Although I suppose not that difficult with BeautifulSoup. We considered using DocBook years ago for the Cheetah manual but didn't because the learning curve was so high. But now that editors like Kate can outline it and validate it and a good XHTML stylesheet has emerged, I'd consider it more now. -- Mike Orr [EMAIL PROTECTED] --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com 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 -~--~~~~--~~--~--~---
Re: WebHelpers 0.6 released
On Jul 11, 4:02 pm, Christoph Haas [EMAIL PROTECTED] wrote: I second rcs_comp (/me donates his parent a few bucks to give him a real name). Real name acquired. Please use Paypal to send me a few bucks, I will make sure to send it on to my mother. ;) Mike Orr wrote: So are applications actually breaking with form method=POST ? Or is this an issue of formal correctness only? I don't think any browser will choke and send the form data using the wrong method. And post is perfectly valid HTML. So I think changing it to lowercase would facilitate XHTML validation (which is important IMO) without having any BC issues. Thanks. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com 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 -~--~~~~--~~--~--~---
Re: WebHelpers 0.6 released
Mike Orr wrote: On Fri, Jul 11, 2008 at 1:09 PM, Ian Bicking [EMAIL PROTECTED] wrote: XHTML is totally nutty. I've been feeling better about XHTML since I started using DocBook. I'm quite glad there's a simple XSLT transformation from DocBook - XHTML to read the text without having to use a WYSIWYG editor (all of which seem to be commercial and/or Java). Converting to HTML 4 seems to be more problematic. Likewise, when I get tired of DocBook's verboseness, I think about making a XHTML - DocBook converter, which would be more difficult than going from HTML. Although I suppose not that difficult with BeautifulSoup. Generally all XSLT engines have the ability to output HTML. I can't remember the invocation, but it's pretty simple. -- Ian Bicking : [EMAIL PROTECTED] : http://blog.ianbicking.org --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com 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 -~--~~~~--~~--~--~---
Re: WebHelpers 0.6 released
I'd like to share a use case with paginate. I've got a model that serves query results in the format I need. It manages starts and limits, includes [totalrow] property so I just need paginate to draw a nice paging bar. Everything works fine, but one line messes it up for me. self.items = list(self.collection[self.first_item-1:self.last_item]) Here it takes only the range from the passed array. My situation implies that I've already got full array fetched from the database, so I need it just to be left intact. so I changed it to self.items = list(self.collection) and it works like a charm. Not sure if it's worth including in the main trunk or I should just create my own version. Please consider this Thanks On Jul 9, 5:38 am, Ben Bangert [EMAIL PROTECTED] wrote: On Jul 8, 2008, at 6:26 PM, Jose Galvez wrote: Great Job Mike, webhelpers is a fantastic tool! But since you've removed the javascript stuff (which you really can't be blamed for, I can only imagine how hard it is to keep up with the moving target that is javascript libs) does anyone have a link_to_remote equivalent that works with jquery? The JS libs are definitely fast moving targets. I'm adding a 'Snippets' section to the new PylonsHQ site, which I think would be a great place to accumulate some recipes on common AJAX setups for Pylons controllers and the JS for a specific JS lib that goes with it. Cheers, Ben smime.p7s 3KDownload --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com 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 -~--~~~~--~~--~--~---
Re: WebHelpers 0.6 released
Edit: I can access the original object by c.myobj.collection so that pretty much does it but still. On Jul 9, 3:30 pm, Pavel Skvazh [EMAIL PROTECTED] wrote: I'd like to share a use case with paginate. I've got a model that serves query results in the format I need. It manages starts and limits, includes [totalrow] property so I just need paginate to draw a nice paging bar. Everything works fine, but one line messes it up for me. self.items = list(self.collection[self.first_item-1:self.last_item]) Here it takes only the range from the passed array. My situation implies that I've already got full array fetched from the database, so I need it just to be left intact. so I changed it to self.items = list(self.collection) and it works like a charm. Not sure if it's worth including in the main trunk or I should just create my own version. Please consider this Thanks On Jul 9, 5:38 am, Ben Bangert [EMAIL PROTECTED] wrote: On Jul 8, 2008, at 6:26 PM, Jose Galvez wrote: Great Job Mike, webhelpers is a fantastic tool! But since you've removed the javascript stuff (which you really can't be blamed for, I can only imagine how hard it is to keep up with the moving target that is javascript libs) does anyone have a link_to_remote equivalent that works with jquery? The JS libs are definitely fast moving targets. I'm adding a 'Snippets' section to the new PylonsHQ site, which I think would be a great place to accumulate some recipes on common AJAX setups for Pylons controllers and the JS for a specific JS lib that goes with it. Cheers, Ben smime.p7s 3KDownload --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com 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 -~--~~~~--~~--~--~---
Re: WebHelpers 0.6 released
Hi, Pavel... On Mittwoch, 9. Juli 2008, Pavel Skvazh wrote: I'd like to share a use case with paginate. I've got a model that serves query results in the format I need. It manages starts and limits, includes [totalrow] property so I just need paginate to draw a nice paging bar. Everything works fine, but one line messes it up for me. self.items = list(self.collection[self.first_item-1:self.last_item]) Here it takes only the range from the passed array. My situation implies that I've already got full array fetched from the database, so I need it just to be left intact. so I changed it to self.items = list(self.collection) and it works like a charm. Why do you do that? If you just use the .pager() method to draw the paging bar then you shouldn't need the self.items there (unless you use it somewhere else). However I think this case is kind of special and I'm hesitating to add that to the code right away. Cheers Christoph signature.asc Description: This is a digitally signed message part.
Re: WebHelpers 0.6 released
I'm not sure either. You've got a lot of use cases covered already. Here's what i do: collection = Companies.list(limit, start) c.companies = h.Page(collection['items'], page, limit, collection['total']) return render('/portal/companies/companies.mako') Then I've got template: % for company in c.companies.collection: % endfor ${c.companies.pager('Page: ~1~', 'id')} Since there's appears to be no way to just draw the paginator without initing Page, that`s the way to do it for now. Probably it'll make sense to add this On Jul 9, 4:09 pm, Christoph Haas [EMAIL PROTECTED] wrote: Hi, Pavel... On Mittwoch, 9. Juli 2008, Pavel Skvazh wrote: I'd like to share a use case with paginate. I've got a model that serves query results in the format I need. It manages starts and limits, includes [totalrow] property so I just need paginate to draw a nice paging bar. Everything works fine, but one line messes it up for me. self.items = list(self.collection[self.first_item-1:self.last_item]) Here it takes only the range from the passed array. My situation implies that I've already got full array fetched from the database, so I need it just to be left intact. so I changed it to self.items = list(self.collection) and it works like a charm. Why do you do that? If you just use the .pager() method to draw the paging bar then you shouldn't need the self.items there (unless you use it somewhere else). However I think this case is kind of special and I'm hesitating to add that to the code right away. Cheers Christoph signature.asc 1KDownload --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com 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 -~--~~~~--~~--~--~---
Re: WebHelpers 0.6 released
Getting the following error following the doc examples: Python 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit (Intel)] on win32 items = range(1,24) import webhelpers.paginate page2 = webhelpers.paginate.Page(items, page=2, items_per_page=10) page2.pager() Traceback (most recent call last): File stdin, line 1, in module File c:\python25\lib\site-packages\WebHelpers-0.6-py2.5.egg\webhelpers\pagina te.py, line 688, in pager result = re.sub(r'~(\d+)~', _range, format) File C:\Python25\lib\re.py, line 150, in sub return _compile(pattern, 0).sub(repl, string, count) File c:\python25\lib\site-packages\WebHelpers-0.6-py2.5.egg\webhelpers\pagina te.py, line 661, in _range nav_items.append( _pagerlink(thispage, text) ) File c:\python25\lib\site-packages\WebHelpers-0.6-py2.5.egg\webhelpers\pagina te.py, line 597, in _pagerlink link_url = url_for(**link_params) File c:\python25\lib\site-packages\Routes-1.9.2-py2.5.egg\routes\util.py, li ne 166, in url_for encoding = config.mapper.encoding File c:\python25\lib\site-packages\Routes-1.9.2-py2.5.egg\routes\__init__.py , line 14, in __getattr__ return getattr(self.__shared_state, name) AttributeError: 'thread._local' object has no attribute 'mapper' On Wed, Jul 9, 2008 at 8:59 AM, Pavel Skvazh [EMAIL PROTECTED] wrote: I'm not sure either. You've got a lot of use cases covered already. Here's what i do: collection = Companies.list(limit, start) c.companies = h.Page(collection['items'], page, limit, collection['total']) return render('/portal/companies/companies.mako') Then I've got template: % for company in c.companies.collection: % endfor ${c.companies.pager('Page: ~1~', 'id')} Since there's appears to be no way to just draw the paginator without initing Page, that`s the way to do it for now. Probably it'll make sense to add this On Jul 9, 4:09 pm, Christoph Haas [EMAIL PROTECTED] wrote: Hi, Pavel... On Mittwoch, 9. Juli 2008, Pavel Skvazh wrote: I'd like to share a use case with paginate. I've got a model that serves query results in the format I need. It manages starts and limits, includes [totalrow] property so I just need paginate to draw a nice paging bar. Everything works fine, but one line messes it up for me. self.items = list(self.collection[self.first_item-1:self.last_item]) Here it takes only the range from the passed array. My situation implies that I've already got full array fetched from the database, so I need it just to be left intact. so I changed it to self.items = list(self.collection) and it works like a charm. Why do you do that? If you just use the .pager() method to draw the paging bar then you shouldn't need the self.items there (unless you use it somewhere else). However I think this case is kind of special and I'm hesitating to add that to the code right away. Cheers Christoph signature.asc 1KDownload --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com 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 -~--~~~~--~~--~--~---
Re: WebHelpers 0.6 released
On Jul 9, 2008, at 8:49 AM, Garland, Ken R wrote: Getting the following error following the doc examples: Python 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit (Intel)] on win32 items = range(1,24) import webhelpers.paginate page2 = webhelpers.paginate.Page(items, page=2, items_per_page=10) page2.pager() To generate a pager with links to each page, it does use Routes, which means you need to have imported Routes, and setup a Mapper. That should work if you do it in a template in a Pylons app for example. Cheers, Ben smime.p7s Description: S/MIME cryptographic signature
Re: WebHelpers 0.6 released
On Wed, Jul 9, 2008 at 4:30 AM, Pavel Skvazh [EMAIL PROTECTED] wrote: I'd like to share a use case with paginate. I've got a model that serves query results in the format I need. It manages starts and limits, includes [totalrow] property so I just need paginate to draw a nice paging bar. If you find the navigator too restrictive, you can build your own in HTML and use the page.* attributes to look up the statistics. For instance, our users did not like the fact that the next link moves depending on the width of the page numbers and whether it's the first page. They preferred our older first/prev/next/last buttons and a little form to choose the page number. But the form had to provide a hidden parameter which I couldn't pass through .pager(). So I finally gave up on .pager() and made a custom navigator in a Mako function, which is nested inside my generic page function that takes a 'page' object. -- Mike Orr [EMAIL PROTECTED] --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com 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 -~--~~~~--~~--~--~---
Re: WebHelpers 0.6 released
Great Job Mike, webhelpers is a fantastic tool! But since you've removed the javascript stuff (which you really can't be blamed for, I can only imagine how hard it is to keep up with the moving target that is javascript libs) does anyone have a link_to_remote equivalent that works with jquery? Jose Mike Orr wrote: WebHelpers 0.6 final has been released. Just do: $ easy_install -U WebHelpers For now you'll have to read the docstrings in the source code for documentation. I'm hoping these will be included online in the Pylons 0.9.7 documentation as soon as that project is finished. Here's what's available online for now: http://docs.pylonshq.com/helpers.html There's a detailed howto for webhelpers.paginage, and a brief description of the rest of the package. Pylons 0.9.6 users using the stable version of WebHelpers should be able to upgrade as-is, although there's no particular benefit unless you want to start using the new (non-rails) helpers. You may have to add the following to helpers.py: from webhelpers.rails import * from routes import url_for from pylons.controllers.util import redirect_to We're trying to eliminate WebHelper's dependencies on Routes; that's the reason for the second two imports. Pylons 0.9.7-dev users who are using the rails helpers should add this to helpers.py: from webhelpers.rails.wrapped import * (And remove any other rails import, and add the url_for and redirect_to import above.) The ``wrapped`` module contains specially wrapped versions of all the rails helpers which will not be escaped by Pylons 0.9.7's default Mako filter. Otherwise you'll find escaped to lt; on your web pages. Users ready to upgrade from the rails helpers (which are all deprecated now) should see What's New in Pylons 0.9.7? for a list of suggested imports that are most similar to the rails helpers. The functions are similar but not always identical, so check the argument signature and function docstring. The biggest change is that the option order in webhelpers.html.tags.select() is the opposite of the old options_for_select(): value before label instead of label before value. There are tradeoffs both ways on this, but doing .items() on a dict whose keys are SELECT values seems more common than dicts whose keys are SELECT labels. All Javascript in WebHelpers has been deprecated, including Prototype, Scriptaculous, and link_to_remote(). We can't keep up with the rapid evolution of Javascript libraries, and the best one changes every six months. Several users have come up with short manual replacements to link_to_remote(), which you can ask about here or on IRC. Those wanting a comprehensive Javascript library can look at YUI, JQuery, ExtJS, ForkJavascript, etc. The rails helpers and Javascript stuff will be deleted in a future version of WebHelpers, so now is a good time to start migrating from them. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com 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 -~--~~~~--~~--~--~---
Re: WebHelpers 0.6 released
On Jul 8, 2008, at 6:26 PM, Jose Galvez wrote: Great Job Mike, webhelpers is a fantastic tool! But since you've removed the javascript stuff (which you really can't be blamed for, I can only imagine how hard it is to keep up with the moving target that is javascript libs) does anyone have a link_to_remote equivalent that works with jquery? The JS libs are definitely fast moving targets. I'm adding a 'Snippets' section to the new PylonsHQ site, which I think would be a great place to accumulate some recipes on common AJAX setups for Pylons controllers and the JS for a specific JS lib that goes with it. Cheers, Ben smime.p7s Description: S/MIME cryptographic signature