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: supervisor questions
On Mon, Jul 7, 2008 at 4:37 PM, Shannon -jj Behrens [EMAIL PROTECTED] wrote: Hi, I'm looking at http://wiki.pylonshq.com/display/pylonscookbook/Monitor+Pylons+application+with+supervisord. I have a few questions: 1. Why does it use a manually created server.py instead of using paster like normal? 2. Does anyone have an rc script to start supervisor under Ubuntu? 3. Is anyone doing any fancy log rotation or are the defaults reasonable? I decided to use runit. I blogged about how and why here: http://jjinux.blogspot.com/2008/07/linux-running-paster-under-runit-on.html I'm not trying to dissuade anyone else from using Supervisor. Best Regards, -jj -- It's a walled garden, but the flowers sure are lovely! http://jjinux.blogspot.com/ --~--~-~--~~~---~--~~ 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: best way to get user's IP address in pylons?
On Mon, Jul 7, 2008 at 6:18 PM, Shannon -jj Behrens [EMAIL PROTECTED] wrote: Ugh, looking at request.environ, Varnish is giving me HTTP_X_FORWARDED_FOR. Looking at my old Aquarium code, it respected X_FORWARDED_HOST. Looking at Paste's proxy middleware, I see that it looks for X-Forwarded-Server. Gees, am I confused! Can someone lend me a clue? It turned out that I just needed to follow the Cookbook recipe a little bit more closely: http://wiki.pylonshq.com/display/pylonscookbook/Running+Pylons+with+NGINX The trick is configuring Nginx with: proxy_set_headerHost $host; proxy_set_headerX-Real-IP $remote_addr; proxy_set_headerX-Forwarded-For $proxy_add_x_forwarded_for; Once you do this, you don't even need to use Paste's proxy middleware. Nginx itself will setup the Host header correctly. I'm still not sure why that recipe configures so many buffer sizes. When I read things like that, it makes me wonder why they're necessary and whether Nginx's own defaults are actually broken. I also wonder if those settings are even appropriate for my situation. Happy Hacking! -jj -- It's a walled garden, but the flowers sure are lovely! http://jjinux.blogspot.com/ --~--~-~--~~~---~--~~ 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: best way to get user's IP address in pylons?
On Jul 9, 2008, at 11:56 AM, Shannon -jj Behrens wrote: The trick is configuring Nginx with: proxy_set_headerHost $host; proxy_set_headerX-Real-IP $remote_addr; proxy_set_headerX-Forwarded-For $proxy_add_x_forwarded_for; Once you do this, you don't even need to use Paste's proxy middleware. Nginx itself will setup the Host header correctly. Actually, you sort of still need to use PasteDeploy's PrefixMiddleware. Especially the version that I think is only in the latest code under the following condition: * You have a site that is proxied to under http AND https This is because the wsgi.url_scheme will get set to http by default, so generating absolute URL's under the https side will result in non- https URL's. The latest trunk of PasteDeploy's PrefixMiddleware will look for another Header, X_FORWARDED_PROTO. So my setup for nginx looks like this (for the HTTPS proxy location): proxy_set_header Host $host; proxy_set_header X_FORWARDED_PROTO https; And I have PrefixMiddleware in my config/middleware.py. PrefixMiddleware will then properly setup the wsgi.url_scheme which ensures that everything makes appropriate URL's for where it is. Cheers, Ben smime.p7s Description: S/MIME cryptographic signature
Re: Development of plugin for registration [Closed]
Sorry! I didn't know the existence of Silverplate (tw.ext.silverplate), a tool with the same intention. http://code.google.com/p/tgtools/ So I'm going to close the tw-registra group and help with Silverplate. On Jul 8, 11:26 pm, Kless [EMAIL PROTECTED] wrote: I've created a new group -tw-registra- to discuss about the design, development and implementation of a plugin/widget for registration on TG2 (Pylons?) using Toscawidgets. The goal is to build a plugin robust, secure, and ready for the future. Its license will be Simplified BSD, so it'll be free for whatever project, included commercial. If you are interested in having a good system of registration, then join to the grouphttp://groups.google.com/group/tw-registra 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
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: Development of plugin for registration
Well, at the end I've decided to follow my own road. Why? Because I'm not going to loose the time creating patches and discussing about topics of security and a better design. I'm going to build this application according to my ideas, and ready for a well security. So, the group [1] remains active for if anybody wants to discuss about the design. [1] http://groups.google.com/group/tw-registra --~--~-~--~~~---~--~~ 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: Debugging failed tests with pylons globals
On Jul 9, 6:22 am, Mike Orr [EMAIL PROTECTED] wrote: Having one SOP, pylons.app, containing all the Pylons globals has long been suggested by me. The value could also be attached to the controller instance -- one attribute instead of several. That would be for users who object to getting request info from a module global, and because I've heard there are some situations (somemod_wsgi applications?) that can't use the SOPs. Not understand what SOPs are all about, can you explain why they would be a problem in mod_wsgi. I keep seeing comments by various people suggesting that they don't really understand how mod_wsgi works. I'd either like to understand what the issue with SOPs is, or if it is a misunderstanding about how mod_wsgi works, then correct that misunderstanding. Thanks. Graham --~--~-~--~~~---~--~~ 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: Debugging failed tests with pylons globals
On Wed, Jul 9, 2008 at 7:04 PM, Graham Dumpleton [EMAIL PROTECTED] wrote: On Jul 9, 6:22 am, Mike Orr [EMAIL PROTECTED] wrote: Having one SOP, pylons.app, containing all the Pylons globals has long been suggested by me. The value could also be attached to the controller instance -- one attribute instead of several. That would be for users who object to getting request info from a module global, and because I've heard there are some situations (somemod_wsgi applications?) that can't use the SOPs. Not understand what SOPs are all about, can you explain why they would be a problem in mod_wsgi. I keep seeing comments by various people suggesting that they don't really understand how mod_wsgi works. I'd either like to understand what the issue with SOPs is, or if it is a misunderstanding about how mod_wsgi works, then correct that misunderstanding. I heard somewhere that SOPs don't work with mod_wsgi, and that request/response/session/c et al were also attached to the controller instance because of that. I've never used mod_wsgi so I don't know if it's true or not. -- 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: Debugging failed tests with pylons globals
On Thu, Jul 10, 2008 at 7:12 AM, Mike Orr [EMAIL PROTECTED] wrote: On Wed, Jul 9, 2008 at 7:04 PM, Graham Dumpleton [EMAIL PROTECTED] wrote: On Jul 9, 6:22 am, Mike Orr [EMAIL PROTECTED] wrote: Having one SOP, pylons.app, containing all the Pylons globals has long been suggested by me. The value could also be attached to the controller instance -- one attribute instead of several. That would be for users who object to getting request info from a module global, and because I've heard there are some situations (somemod_wsgi applications?) that can't use the SOPs. Not understand what SOPs are all about, can you explain why they would be a problem in mod_wsgi. I keep seeing comments by various people suggesting that they don't really understand how mod_wsgi works. I'd either like to understand what the issue with SOPs is, or if it is a misunderstanding about how mod_wsgi works, then correct that misunderstanding. I heard somewhere that SOPs don't work with mod_wsgi, and that request/response/session/c et al were also attached to the controller instance because of that. I've never used mod_wsgi so I don't know if it's true or not. We use mod_wsgi + pylons in production and I've never noticed a problem like that before. Maybe is a configuration problem? -- Lawrence, stacktrace.it - oluyede.org - neropercaso.it It is difficult to get a man to understand something when his salary depends on not understanding it - Upton Sinclair --~--~-~--~~~---~--~~ 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: Debugging failed tests with pylons globals
On Jul 10, 3:12 pm, Mike Orr [EMAIL PROTECTED] wrote: On Wed, Jul 9, 2008 at 7:04 PM, Graham Dumpleton [EMAIL PROTECTED] wrote: On Jul 9, 6:22 am, Mike Orr [EMAIL PROTECTED] wrote: Having one SOP, pylons.app, containing all the Pylons globals has long been suggested by me. The value could also be attached to the controller instance -- one attribute instead of several. That would be for users who object to getting request info from a module global, and because I've heard there are some situations (somemod_wsgi applications?) that can't use the SOPs. Not understand what SOPs are all about, can you explain why they would be a problem in mod_wsgi. I keep seeing comments by various people suggesting that they don't really understand how mod_wsgi works. I'd either like to understand what the issue with SOPs is, or if it is a misunderstanding about how mod_wsgi works, then correct that misunderstanding. I heard somewhere that SOPs don't work with mod_wsgi, and that request/response/session/c et al were also attached to the controller instance because of that. I've never used mod_wsgi so I don't know if it's true or not. The only reference I can find to SOP and mod_wsgi together is a prior comment by you: http://markmail.org/message/wz4yeooo3v3l4ngf Overall there is really nothing special about how mod_wsgi works that would invalidate any specific Python programming techniques. As far as a WSGI application goes, how threading is used should be no different to something like paste server. Since you don't know the reasons why SOPs may be a problem, I'd very much suggest there probably isn't a problem, especially with Ian not really understanding how there would be either. Anyone else know any actual detail about this suggestion that SOPs and mod_wsgi may be a problem. Graham --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---