Re: parameterized controllers
I did something similar using the __before__ method class CustomerController(BaseController): def __before__(self): if 'cust_id' in request.environ['pylons.routes_dict']: cust_id = request.environ['pylons.routes_dict'] ['cust_id'] c.customer=meta.Session.query(Customer).get(cust_id) else: c.customer = None def DoSomething(self, cust_id, id): . def DoMore(self, cust_id, id): . The routes_dict looks like this: {'action': u'dostuff', 'controller': u'customert', 'id': u'123'} Hopefully that works. Cheers Aaron --~--~-~--~~~---~--~~ 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: parameterized controllers
Previously Aaron R wrote: I did something similar using the __before__ method class CustomerController(BaseController): def __before__(self): if 'cust_id' in request.environ['pylons.routes_dict']: cust_id = request.environ['pylons.routes_dict'] ['cust_id'] c.customer=meta.Session.query(Customer).get(cust_id) else: c.customer = None def DoSomething(self, cust_id, id): . def DoMore(self, cust_id, id): . The routes_dict looks like this: {'action': u'dostuff', 'controller': u'customert', 'id': u'123'} Hopefully that works. It works and is indeed better. I still think my approach is nicer: it does not require poking manually at the routes memory but provides a clean interface. 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: parameterized controllers
for a route like /company/:company_id/child_resource/id i do something like: class ChildResourceController(BaseController): def _get_method_args(self): args = BaseController._get_method_args(self) args['campaign'] = model.Company.get(args['campaign_id']) return args def myaction(self, company, id): ... --~--~-~--~~~---~--~~ 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: Deployment Question
El vie, 16-05-2008 a las 13:38 -0700, Jonathan Vanasco escribió: I'm a little unclear on the better ways to deploy a Pylons app. My production servers run nginx -- is it better to use some fastcgi support (if so, how?) or just do a paster serve and proxy to that port? apache + mod_wsgi is other option, powerful and easy. Greetings. --~--~-~--~~~---~--~~ 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: Deployment Question
what is your platform? i just tried fcgid on centos 5.1 not long ago, with mod_fcgid-2.1-3.el5 from epel.repo + apache (version come with centos2.5) + python 2.4, following this wiki http://wiki.pylonshq.com/display/pylonscookbook/Production+Deployment+Using+Apache%2C+FastCGI+and+mod_rewrite%2C+alternate+version there seems to be a bug and i can reproduce it easy. a fresh project create by paster create -t pylons project will run no problem. any other project with sql access will just crash. i've try the quickwiki demo and it won't work too. i've also try mod_wsgi from epel.repo but the same occur. i am too lazy to try and recompile everything so i end up running it behind proxy rgds, Vincent On May 19, 3:44 am, Ross Vandegrift [EMAIL PROTECTED] wrote: On Fri, May 16, 2008 at 01:38:24PM -0700, Jonathan Vanasco wrote: I'm a little unclear on the better ways to deploy a Pylons app. My production servers run nginx -- is it better to use some fastcgi support (if so, how?) or just do a paster serve and proxy to that port? I've read a handful of ways on how-to-deploy apps, and all seem different. I've yet to see a comparison or this is THE way to do it document. All of my apps are deployed in a FastCGI environment with Apache. Our live application server has a custom install of python2.4 with appropriate module versions that we can care for beside the ones that RedHat wants. This works really well. It seems a lot of people hate FCGI for different reasons, but I have found it to be pretty awesome. Apps are very stable, no complicated proxying, and it's almost as performant as mod_python. I have considered converting our deployments to mod_python, but only recently acquired a practical staging environment to test things like that. -- Ross Vandegrift [EMAIL PROTECTED] The good Christian should beware of mathematicians, and all those who make empty prophecies. The danger already exists that the mathematicians have made a covenant with the devil to darken the spirit and to confine man in the bonds of Hell. --St. Augustine, De Genesi ad Litteram, Book II, xviii, 37 --~--~-~--~~~---~--~~ 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: Deployment Question
On Mon, May 19, 2008 at 10:43:06AM -0700, [EMAIL PROTECTED] wrote: what is your platform? i just tried fcgid on centos 5.1 not long ago, with mod_fcgid-2.1-3.el5 from epel.repo + apache (version come with centos2.5) + python 2.4, following this wiki http://wiki.pylonshq.com/display/pylonscookbook/Production+Deployment+Using+Apache%2C+FastCGI+and+mod_rewrite%2C+alternate+version Apache 2.0.52 from RHEL4, Python 2.4, Flup 0.5, some version of fcgi that appears to have been custom installed and I cannot figure out the version for the life of me Ross there seems to be a bug and i can reproduce it easy. a fresh project create by paster create -t pylons project will run no problem. any other project with sql access will just crash. i've try the quickwiki demo and it won't work too. i've also try mod_wsgi from epel.repo but the same occur. i am too lazy to try and recompile everything so i end up running it behind proxy rgds, Vincent On May 19, 3:44 am, Ross Vandegrift [EMAIL PROTECTED] wrote: On Fri, May 16, 2008 at 01:38:24PM -0700, Jonathan Vanasco wrote: I'm a little unclear on the better ways to deploy a Pylons app. My production servers run nginx -- is it better to use some fastcgi support (if so, how?) or just do a paster serve and proxy to that port? I've read a handful of ways on how-to-deploy apps, and all seem different. I've yet to see a comparison or this is THE way to do it document. All of my apps are deployed in a FastCGI environment with Apache. Our live application server has a custom install of python2.4 with appropriate module versions that we can care for beside the ones that RedHat wants. This works really well. It seems a lot of people hate FCGI for different reasons, but I have found it to be pretty awesome. Apps are very stable, no complicated proxying, and it's almost as performant as mod_python. I have considered converting our deployments to mod_python, but only recently acquired a practical staging environment to test things like that. -- Ross Vandegrift [EMAIL PROTECTED] The good Christian should beware of mathematicians, and all those who make empty prophecies. The danger already exists that the mathematicians have made a covenant with the devil to darken the spirit and to confine man in the bonds of Hell. --St. Augustine, De Genesi ad Litteram, Book II, xviii, 37 -- Ross Vandegrift [EMAIL PROTECTED] The good Christian should beware of mathematicians, and all those who make empty prophecies. The danger already exists that the mathematicians have made a covenant with the devil to darken the spirit and to confine man in the bonds of Hell. --St. Augustine, De Genesi ad Litteram, Book II, xviii, 37 --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
fd limit
Is it possible with paster (through .ini files?) to set the max file descriptors available to it? I guess otherwise I'll have to write a wrapper script and do a ulimit. 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: parameterized controllers
On Mon, May 19, 2008 at 12:35 AM, Wichert Akkerman [EMAIL PROTECTED] wrote: Previously Aaron R wrote: I did something similar using the __before__ method class CustomerController(BaseController): def __before__(self): if 'cust_id' in request.environ['pylons.routes_dict']: cust_id = request.environ['pylons.routes_dict'] ['cust_id'] c.customer=meta.Session.query(Customer).get(cust_id) else: c.customer = None def DoSomething(self, cust_id, id): . def DoMore(self, cust_id, id): . The routes_dict looks like this: {'action': u'dostuff', 'controller': u'customert', 'id': u'123'} Hopefully that works. It works and is indeed better. I still think my approach is nicer: it does not require poking manually at the routes memory but provides a clean interface. def __before__(self, cust_id): You can also use c.cust_id because all routing variables are shadowed onto 'c'. -- 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: Deployment Question
On Sun, May 18, 2008 at 12:44 PM, Ross Vandegrift [EMAIL PROTECTED] wrote: On Fri, May 16, 2008 at 01:38:24PM -0700, Jonathan Vanasco wrote: I'm a little unclear on the better ways to deploy a Pylons app. My production servers run nginx -- is it better to use some fastcgi support (if so, how?) or just do a paster serve and proxy to that port? I've read a handful of ways on how-to-deploy apps, and all seem different. I've yet to see a comparison or this is THE way to do it document. There is no THE way to do it. There are several ways which perform well, and some of them may even work on your platform. I prefer HTTP proxying because it's the closest to native request handling. This works really well. It seems a lot of people hate FCGI for different reasons, but I have found it to be pretty awesome. People hate FCGI because it was buggy and error-prone for years. Maybe it has gotten better now. Apps are very stable, no complicated proxying, and it's almost as performant as mod_python. As you see, complicated is in the eye of the beholder. :) I would say proxying is less complicated than *CGI. I have considered converting our deployments to mod_python, but only recently acquired a practical staging environment to test things like that. There was a point in using mod_python before mod_wsgi existed. Now that mod_wsgi exists, is more directly related to the task, and has a better history of being reliable, why not use it? -- 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: fd limit
On Mon, May 19, 2008 at 12:01 PM, Anil [EMAIL PROTECTED] wrote: Is it possible with paster (through .ini files?) to set the max file descriptors available to it? I guess otherwise I'll have to write a wrapper script and do a ulimit. Paster doesn't interpret config options itself. It merely instantiates the indicated server with the given arguments. I doubt any of the servers used for Pylons apps sets the ulimit, since it's such an OS-specific thing. Actually, Paster does interpret some options if you make the config script executable (#!/usr/bin/paster) and add an [exe] section for the options. But still there's no ulimit= option, although that could be added. But most people do not use paster this way, and Ian has said he's not sure if paster's self-daemonization feature is a good idea anyway. (Because it duplicates the functionality of OS-level daemon managers.) -- 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: fd limit
Anil wrote: Is it possible with paster (through .ini files?) to set the max file descriptors available to it? I guess otherwise I'll have to write a wrapper script and do a ulimit. It doesn't, and I'm not sure you actually can from inside the process. My vague recollection is that you really need to do that from a wrapper script. Even if you can, I'm not sure where it'd go in the config file, so I'd still suggest just sticking with a wrapper. -- 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: Authkit - colliding cookies
On Sun, May 18, 2008 at 7:10 AM, Moshe C. [EMAIL PROTECTED] wrote: Hi, I have two parallel applications running from the same host but on different ports. How do I configure Authkit so that each one creates a unique cookie. Currently if you log into one app, you are also authenticated for the other. The cookie name is the host name. Normally, the cookie is specific to a (protocol, host, port) triple (I'm hand waiving a bit). Are you doing some weird sort of proxying with Apache so that the two different apps are both available under port 80 but with different paths? That's the only thing I can think of that would cause this behavior. Don't forget, you can also use separate subdomains. Best Regards, -jj -- I, for one, welcome our new Facebook overlords! 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: Beaker Trunk With Appengine
On Fri, May 16, 2008 at 11:16 AM, Anil [EMAIL PROTECTED] wrote: I am trying to run pylons with google app engine and everything is working perfectly locally, but when I upload the site live beaker gives me the following error. Anyone have any idea on where to start debugging? http://pastebin.com/m7fc2a3c7 I'm going to hazard some guesses: * You're not saving sessions to disk, are you? Clearly that won't work. * I wonder if this has to do with the fact that your code is running on multiple different servers. * Why are you trying to pickle a function? What's in your session? -jj -- I, for one, welcome our new Facebook overlords! 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 -~--~~~~--~~--~--~---
More WebHelpers 0.6-dev changes
I pushed some changes to WebHelpers 0.6-dev that may affect those using the new helpers. *** NO MORE MAGIC URLS *** webhelpers.html.tags: image() javascript_link() stylesheet_link() auto_discovery_link() webhelpers.html.tools: button_to() These functions no longer do magic on their URL arguments; they output the exact URL given. Previously they called Routes to get the site prefix, and implicitly added prefixes like /images/ and suffixes like .css. This eliminates a fragile Routes dependency in WebHelpers, and a compatibility issue with the upcoming Routes 2. So you should call url_for on all your URL arguments, same as you already do with link_to() and everywhere else you have a URL. Example: h.stylesheet_link(h.url_for(/stylesheets/default.css)) This may look a bit verbose but it's only temporary. Routes 2 will replace ``h.url_for`` with a ``url`` object that's automatically exported to the templates. (WebHelpers 0.6 will be in the imminent Pylons 0.9.7 release. Routes 2 is scheduled for Pylons 0.9.8.) The Rails helpers have not been changed. So the only Routes dependencies remaining in WebHelpers are in Paginate, Pagination (deprecated), and Rails (deprecated). *** IMAGE ALT ATTRIBUTE *** Perhaps more controversially, I made the 'alt' argument to image() a mandatory positional arg. In this age of accessibility, there's no reason to leave these out or let them default to GreenIcon. Previously it invented a default alt value based on the filename stem capitalized. You can pass or None to get a blank alt attribute (alt=), but at least you're making a conscious choice to do this, and also documenting in the template that this image has no semantic value and is pure decoration. *** SELECT() WITH INT VALUES *** select() now handles int values and implicitly converts them to strings for HTML. This allows you to link a select pulldown to an int database value, and to use ints in your options lists. Thanks to Christoph Haas for this patch, which helps my applications too. -- 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: More WebHelpers 0.6-dev changes
select() now handles int values and implicitly converts them to strings for HTML. This allows you to link a select pulldown to an int database value, and to use ints in your options lists. Thanks to Christoph Haas for this patch, which helps my applications too. neat! is there a formencode patch too ;) --~--~-~--~~~---~--~~ 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: Deployment Question
so is Apache considered to be a good thing (through mod_wsgi , mod_python , or other ?) i've been doing mod_perl dev for years, and have had some experience with mod_python -- generally speaking, my experience is that if you can avoid apache you're better off. i guess that's what is throwing me off. i equate apache with isn't there a better way now? --~--~-~--~~~---~--~~ 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: Beaker Trunk With Appengine
On May 16, 2008, at 11:16 AM, Anil wrote: I am trying to run pylons with google app engine and everything is working perfectly locally, but when I upload the site live beaker gives me the following error. Anyone have any idea on where to start debugging? http://pastebin.com/m7fc2a3c Are you using the google backend type? - Ben smime.p7s Description: S/MIME cryptographic signature
Re: Authkit - colliding cookies
No, not using Apache, just paster with two versions of development.ini with different port parameters. The authkit parameters are: authkit.setup.method = form, cookie authkit.form.authenticate.user.data = user:pw authkit.cookie.secret = somestring authkit.cookie.signoutpath = /cntr/signout On 5/20/08, Shannon -jj Behrens [EMAIL PROTECTED] wrote: On Sun, May 18, 2008 at 7:10 AM, Moshe C. [EMAIL PROTECTED] wrote: Hi, I have two parallel applications running from the same host but on different ports. How do I configure Authkit so that each one creates a unique cookie. Currently if you log into one app, you are also authenticated for the other. The cookie name is the host name. Normally, the cookie is specific to a (protocol, host, port) triple (I'm hand waiving a bit). Are you doing some weird sort of proxying with Apache so that the two different apps are both available under port 80 but with different paths? That's the only thing I can think of that would cause this behavior. Don't forget, you can also use separate subdomains. Best Regards, -jj -- I, for one, welcome our new Facebook overlords! 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: More WebHelpers 0.6-dev changes
On Mon, May 19, 2008 at 9:07 PM, Jonathan Vanasco [EMAIL PROTECTED] wrote: is there a formencode patch too ;) For what? -- 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: Deployment Question
On Mon, May 19, 2008 at 9:10 PM, Jonathan Vanasco [EMAIL PROTECTED] wrote: so is Apache considered to be a good thing (through mod_wsgi , mod_python , or other ?) i've been doing mod_perl dev for years, and have had some experience with mod_python -- generally speaking, my experience is that if you can avoid apache you're better off. i guess that's what is throwing me off. i equate apache with isn't there a better way now? It's stable, gives you HTTPS and rewrite and named virtual hosts, and gives clients a warm fuzzy feeling that you're using something they've heard of. People say it also has a better knowledge of the quirky useragents out there and can correct misformed requests better than just exposing PasteHTTPServer or CherryPy directly, though I don't know how true it is. There are a few newer servers now (nginx, lighthttpd, cherokee) that claim to be smaller, more efficient, and better organized than Apache. On my production server I've found Apache sufficient so I haven't bothered with them. But I do have a virtual server for our local Python group, with Apache running Mailman and MoinMoin, and Apache regularly dies there with an Out of Memory error, or the kernel's memory terminator kills it and then hangs. So I've been meaning to try nginx there and see if it works better. -- 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: Deployment Question
On May 20, 2:10 pm, Jonathan Vanasco [EMAIL PROTECTED] wrote: so is Apache considered to be a good thing (through mod_wsgi , mod_python , or other ?) i've been doing mod_perl dev for years, and have had some experience with mod_python -- generally speaking, my experience is that if you can avoid apache you're better off. i guess that's what is throwing me off. i equate apache with isn't there a better way now? It really depends on what you want to do. If you are running some small site more or less anything will do as it generally isn't the web server that is your bottleneck. Of course, if you are running in a memory constrained VPS you wouldn't use Apache unless you properly investigate properly how you need to configure it to work under such a constraint. If you are going to run a large site which is able to respond well to bursts in traffic, running Python embedded in Apache running prefork MPM, with huge amounts of memory in the box is generally the best approach. This is because although memory usage will be high, being non multithreaded you can use any cpu/cores to best advantage, plus you benefit from Apache's ability to create dynamically more processes to handle demand when required and then reap them when no longer required. In other words, it is impossible to answer you question without really knowing what your site is doing, how big it is, amount of traffic etc etc. 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 -~--~~~~--~~--~--~---