Re: AuthKit for Static Files
On Apr 7, 10:11 am, Jason Reid reid.ja...@gmail.com wrote: Nevermind; I should have just did a little more googling. If anyone is interested in this; it seems quite easy usingmod_wsgi for Apache. I dont care about the other ones really so no big deal.http://code.google.com/p/modwsgi/wiki/AccessControlMechanisms Note that Apache is actually handling the HTTP Digest mechanism, the only thing that is being delegated to Python code is the generation of the hash for comparison of user details. Because that Python code runs embedded in Apache worker process, you should make it as absolutely minimal as possible if still running Pylons using Paste behind mod_proxy. In other words, don't just go importing all your Pylons/AuthKit infrastructure as it will only serve to bloat our the Apache worker process unnecessarily. Writing a custom bit of code which does only what you need would be the best approach. Graham They have a sample for django and I should be able to move that to Pylons quite easily. On Apr 6, 8:06 pm, Jason Reid reid.ja...@gmail.com wrote: I have not dived into Pylons yet; but the question I am curious about is how I would use AuthKit's authentication (digest specifically) too protect static content (I dont mean images; I am server rather large; over 4GB files) and I need them secured. I was using Django and it had a thing that let mod_python basically interface with its Authentication from apache. I dont know if AuthKit has that sort of feature; but how would I even configure that as Pylons is running through paste - however static content wouldn't be - or could it be efficiently? I am wondering if there is away to have AuthKit be my digest mechanism while using Apache2 or lighttpd or nginx (I would love a solution that encompasses all three :D) --~--~-~--~~~---~--~~ 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 pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: cron maintenance script, need access to pylons globals object...
Try doing this as a custom paste command.You can simply write a command for paste; then you call that command like paster command (i think; its in the documentation on how to use it). On Apr 6, 7:19 pm, eleith ele...@gmail.com wrote: i've got a cron script that runs daily that uses many of my pylons project's models and libs. i'm using the following method to get at the models/libs and it works well import sys sys.path.append('/path/to/myapp') from paste.deploy import appconfig from myapp.config.environment import load_environment conf = appconfig('config:/path/to/myapp/development.ini') load_environment(conf.global_conf, conf.local_conf) from myapp.model import * from myapp.lib import * everything works, accept whenever my model or my libs encounter a pylons global variable (g.something). whenever it encounters this i get the error output -- File /usr/lib/python2.5/site-packages/Paste-1.7.2-py2.5.egg/paste/ registry.py, line 137, in __getattr__ return getattr(self._current_obj(), attr) File /usr/lib/python2.5/site-packages/Paste-1.7.2-py2.5.egg/paste/ registry.py, line 194, in _current_obj 'thread' % self.name__) TypeError: No object (name: app_globals) has been registered for this thread - while i certainly could get access to my global variables through config['pylons.app_globals'], my pylons project has already been written using g.something throughout. is my only option to go through and rewrite my project without using the g variable, or is there a way for it to be pulled in when i run my cron script. (all the global variables are static, i just have many of them, so i used the globals object instead of ini, to not have so much stuff in my ini file) any suggestions? --~--~-~--~~~---~--~~ 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 pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: AuthKit for Static Files
Well Apache handles the HTTP Digest mechanism only if I am using mod_wsgi with a custom backend. Using Paste the Authkit middleware handles that. What I was hoping for was the ability to use the Authkit middleware (so it links to my database); as well as be able to encompass serving my static files. The only way to do that it seems is to use mod_wsgi and use a custom authentication provider and point it at a custom script that works with Authkit. On Apr 7, 3:38 am, Graham Dumpleton graham.dumple...@gmail.com wrote: On Apr 7, 10:11 am, Jason Reid reid.ja...@gmail.com wrote: Nevermind; I should have just did a little more googling. If anyone is interested in this; it seems quite easy usingmod_wsgi for Apache. I dont care about the other ones really so no big deal.http://code.google.com/p/modwsgi/wiki/AccessControlMechanisms Note that Apache is actually handling the HTTP Digest mechanism, the only thing that is being delegated to Python code is the generation of the hash for comparison of user details. Because that Python code runs embedded in Apache worker process, you should make it as absolutely minimal as possible if still running Pylons using Paste behind mod_proxy. In other words, don't just go importing all your Pylons/AuthKit infrastructure as it will only serve to bloat our the Apache worker process unnecessarily. Writing a custom bit of code which does only what you need would be the best approach. Graham They have a sample for django and I should be able to move that to Pylons quite easily. On Apr 6, 8:06 pm, Jason Reid reid.ja...@gmail.com wrote: I have not dived into Pylons yet; but the question I am curious about is how I would use AuthKit's authentication (digest specifically) too protect static content (I dont mean images; I am server rather large; over 4GB files) and I need them secured. I was using Django and it had a thing that let mod_python basically interface with its Authentication from apache. I dont know if AuthKit has that sort of feature; but how would I even configure that as Pylons is running through paste - however static content wouldn't be - or could it be efficiently? I am wondering if there is away to have AuthKit be my digest mechanism while using Apache2 or lighttpd or nginx (I would love a solution that encompasses all three :D) --~--~-~--~~~---~--~~ 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 pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: Pylons + Dojo
It worked! based on your suggestion, I tried on google and I found the site: http://www.rexx.com/~dkuhlman/ http://www.rexx.com/%7Edkuhlman/ Thanks for your help! See the results below! CLASS def login(self, sUsrNme, sUstPwd): result = OK return result routing.py map.connect('route01', '/teste/login/:sUsrNme/:sUstPwd', controller='teste', action='login', sUsrNme='[void]', sUstPwd='[void]' ) javascript call var xhrArgs = { url: /Security/login/:Usr/:Pwd, On Mon, Apr 6, 2009 at 6:06 PM, Jens Hoffrichter jens.hoffrich...@gmail.com wrote: Hi Mauricio, 2009/4/6 Mauricio Daniel Hoffart maud...@gmail.com: I am new to pyton I am trying to use Pylons + Dojo and I am having trouble calling a control with multiple parameters. What is an example of that? Thanks a lot Ex: --IN THE CONTROLLER class TesteController(BaseController): @jsonify def login(self, sUsrNme, sUstPwd ): result = ok return result --IN THE PAGE var xhrArgs = { url: /teste/login/, postData: {Master,Senha}, handleAs: json, load: function(sUsrNme, sUsrPwd ){ dojo.byId(basicFormTab).innerHTML = Message posted.; }, error: function(error){ dojo.byId(basicFormTab).innerHTML = We'll 404 in the demo, but that's okay. We don't have a 'postIt' service on the docs server. ; } } The error returned is: TypeError: login() takes exactly 3 arguments (1 given) If you set parameters to the function, they are expected to be given in the url (through a routes parameter, so you would have to configure a route for that one) - and example for that would be /teste/login/Master, then the first argument to the action would be Master If you post to the action, like you do, you have to take a look at the request dictionary, which wil contain the parameters you posted to the function, or were in get parameters. I hope that helps! Cheers, Jens --~--~-~--~~~---~--~~ 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 pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: Deployment in a hosted environment
On Mon, Apr 06, 2009 at 04:52:27PM -0700, edgarsmolow wrote: I've never used plesk The issue is not just not using a GUI. The hosting company provides valuable services (for surprisingly little money) that we would otherwise have to do ourselves (a real cost to our company). In order to run a Pylons application, is it necessary to manage the box ourselves? If so, I wish I had known that beforehand. If your host is resistant to supporting mod_wsgi or reverse proxies, see if you get FastCGI support. Pylons runs great under FastCGI, and it's a bit more routine of a thing to have installed. Ross -- Ross Vandegrift r...@kallisti.us If the fight gets hot, the songs get hotter. If the going gets tough, the songs get tougher. --Woody Guthrie --~--~-~--~~~---~--~~ 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 pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Multi-Project Setup
Hi there, I am currently developing a pylons-application with elixir on top that has a multi-project setup included. It should work the following way: A user visits a url like /myapp/project/1 ... and the project-id 1 is saved in the session. After that, the user is redirected to the login-page where he can perform a project- specific login. Each project owns a separate database and therefore an own data model with a standardized interface. Now i'm looking for the best way to achieve this. By default, pylons creates the database using the connection string from the ini-file, so it would be an idea to use separate ini-files per project, but it seems impossible since the application has already bootstrapped when the model shall be selected. Does anybody have a hint how to get there? Thanks a lot. --~--~-~--~~~---~--~~ 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 pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Change response status in error document
Hi all, I used to (Pylons 0.9.7rc4 previously) force the response status to 200 in some circumstances (like a request from a flash player since it can't handle anything but status 200...). I updated to 0.9.7 yesterday it doesn't work anymore. response.status_int in ErrorController used to work. But in StatusCodeRedirect, the status coming from the 2nd call to call_wsgi_application() (newstatus, coming from ErrorController) is ignored. status, headers, app_iter, exc_info = call_wsgi_application( self.app, environ, catch_exc_info=True) if status[:3] in self.errors and \ 'pylons.status_code_redirect' not in environ and self.error_path: # Create a response object environ['pylons.original_response'] = Response( status=status, headerlist=headers, app_iter=app_iter) environ['pylons.original_request'] = Request(environ) # Create a new environ to avoid touching the original request data new_environ = environ.copy() new_environ['PATH_INFO'] = self.error_path newstatus, headers, app_iter, exc_info = call_wsgi_application( self.app, new_environ, catch_exc_info=True) start_response(status, headers, exc_info) Is there an official way to permit the ErrorController to change the response status? Thanks a lot! Gus --~--~-~--~~~---~--~~ 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 pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: cookie-based sessions
On Apr 7, 2009, at 5:52 AM, edgarsmolow wrote: http://pylonshq.com/docs/en/0.9.7/sessions/#id2 but did not see a reference to these fields (you mentioned): session['_id'] session['_accessed_time'] session['_creation_time'] I suppose I still don't understand the problem. If the cookie exists, when the browser is first directed to a URL, why can Beaker (or whichever component is involved) read the cookie? If it had read the cookie, session['some_var'] would be available. I'm not sure I understand what you're talking about either. The code sample you originally included could be translated like so: If there's a cookie already present: do something with it otherwise, when no cookie is around: do something else On the first visit to the web page, of course there isn't a cookie YET, its the first visit after all. So the second if statement runs. On the second visit, since they've been there before, there's a cookie present, so the first if statement runs. This seems obvious enough, I'm not sure where the confusion is? Cheers, Ben smime.p7s Description: S/MIME cryptographic signature
Re: cookie-based sessions
On Apr 7, 2009, at 10:36 , Ben Bangert wrote: On Apr 7, 2009, at 5:52 AM, edgarsmolow wrote: http://pylonshq.com/docs/en/0.9.7/sessions/#id2 but did not see a reference to these fields (you mentioned): session['_id'] session['_accessed_time'] session['_creation_time'] I suppose I still don't understand the problem. If the cookie exists, when the browser is first directed to a URL, why can Beaker (or whichever component is involved) read the cookie? If it had read the cookie, session['some_var'] would be available. I'm not sure I understand what you're talking about either. The code sample you originally included could be translated like so: If there's a cookie already present: do something with it otherwise, when no cookie is around: do something else On the first visit to the web page, of course there isn't a cookie YET, its the first visit after all. So the second if statement runs. On the second visit, since they've been there before, there's a cookie present, so the first if statement runs. This seems obvious enough, I'm not sure where the confusion is? I think perhaps what he is expecting is a persistent cookie -- which is not what sessions and session cookies are all about? Thorsten --~--~-~--~~~---~--~~ 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 pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: AuthKit for Static Files
On Mon, Apr 6, 2009 at 5:06 PM, Jason Reid reid.ja...@gmail.com wrote: I have not dived into Pylons yet; but the question I am curious about is how I would use AuthKit's authentication (digest specifically) too protect static content (I dont mean images; I am server rather large; over 4GB files) and I need them secured. You can move them out of the public directory and serve them in a controller action; then you can apply the normal AuthKit controls to it. For instance, I had to log a directory of static help files using logging code I had already written for Pylons. # routing.py map.connect(help, /help/{url:.*}, controller=main, action=help) # MainController.py def help(self, url, environ, start_response): ``url`` is the rest of the request path. ``environ`` and ``start_response`` are special args in Pylons, used to chain to another WSGI application. # Using the Unipath package here, but you can use os.path instead. url = Path(url or index.htm) page = url.stem # Base filename without directory or extension. help_dir = Path(config[pylons.paths][help_files]) # My own config variable. path = Path(help_dir, url) if not path.exists(): abort(404) if url.ext == .htm and not page.startswith(wh): self.sitestats.log_event(help, page)# My logging code; log view of help section. app = FileApp(path) return app(environ, start_response) -- Mike Orr sluggos...@gmail.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 pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: new to Pylons! Help with install
On Apr 3, 6:28 pm, RB2 rb2@gmail.com wrote: Thanks for the tips. unfortunately there isn't a windows install for setupstools with python 2.6 . if i read the docs you mentioned correctly my only option is to remove python2.6 and install python2.5. Thanks again and i appreciate the time. On Apr 2, 1:56 pm, Thomas G. Willis tom.wil...@gmail.com wrote: On Apr 2, 12:00 pm, RB2 rb2@gmail.com wrote: Hello Is there a Windows install available? When i click on the Download link in the pylonshq.com web site it brings you to the get started page but does not have the install files available. The system i would be installing Pylons on is not connected to the internet so i can not do an internet install. If i browse to the pylonshq.com/download page it has all the required files but i do not want to install them individually. 2nd question. Is Mako still the default template engine??? Thanks If you install setuptools,http://pypi.python.org/pypi/setuptools you will have the easy_install program. Then just c:\easy_install. pylonse src vers Ah you didn't mention 2.6 and I assumed. sorry about that. looks like in the source version there's an ez_setup.py script. I would suspect that extracting the tar ball and running python ez_setup.py might get you there, but I don't have a 2.6 install handy to try it. --~--~-~--~~~---~--~~ 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 pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: Deployment in a hosted environment
On Apr 6, 4:57 pm, Paweł Stradomski pstradom...@gmail.com wrote: W liście edgarsmolow z dnia wtorek, 7 kwietnia 2009: I've never used plesk The issue is not just not using a GUI. The hosting company provides valuable services (for surprisingly little money) that we would otherwise have to do ourselves (a real cost to our company). In order to run a Pylons application, is it necessary to manage the box ourselves? If so, I wish I had known that beforehand. Edgar Depends on what do you mean by managing the box yourself. Yeah, what he said. How 'bout a developer-friendly hosting company like WebFaction? Surely you can afford $9.50/month (or less if you pay yearly) for shell access AND a decent control panel. They manage the box; you manage your apps. webfaction.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 pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: What I've learned deploying pylons
On Tue, Mar 31, 2009 at 9:44 AM, Wyatt Baldwin wyatt.lee.bald...@gmail.comwrote: On Mar 30, 11:08 pm, Wichert Akkerman wich...@wiggy.net wrote: Previously Wyatt Baldwin wrote: Questions: Which versions of supervisor and Python are ya'll using together? Should I go for supervisor 2.1 or 2.2b1 or 3.0a6 or ...? Everyone is running 3.0a6 as far as I know. Anybody using it with Python 2.6 or have plans to? On Apr 6, 5:29 pm, Jose Galvez jj.gal...@gmail.com wrote: Well I sure hope it works with 2.6, I just started using it (upgraded to the development svs version as the production version is about a year old) and love it. So I guess I'll be giving it a try on 2.6 as soon as Jaunty (Ubuntu 9.04) comes out at the end of the month as 2.6 will finally be the default version of python in Ubuntu with the new release It *seems* to work with 2.6, but it throws out an error when starting or stopping a service/app. That makes me nervous for something that's supposed to be monitoring critical apps. For now, I've installed Python 2.5 just to run supervisor, while running my apps on 2.6. BTW, my research indicates that the problem is not with supervisor directly but rather with some sort of API breakage in asyncore (and/or asynchat) in Python 2.6. --~--~-~--~~~---~--~~ 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 pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: cookie-based sessions
I probably wanted this instead: ## set response.set_cookie('sitelang', 'uk', expires=3600) # Pylons 0.9.6 syntax. response.set_cookie('sitelang', 'uk', max_age=3600) # Pylons 0.9.7 syntax. ## get lang = request.cookies['sitelang'] from here: http://wiki.pylonshq.com/display/pylonscookbook/Setting+cookies+and+response+headers Edgar On Apr 7, 1:52 pm, Thorsten Lockert tlock...@gmail.com wrote: On Apr 7, 2009, at 10:36 , Ben Bangert wrote: On Apr 7, 2009, at 5:52 AM, edgarsmolow wrote: http://pylonshq.com/docs/en/0.9.7/sessions/#id2 but did not see a reference to these fields (you mentioned): session['_id'] session['_accessed_time'] session['_creation_time'] I suppose I still don't understand the problem. If the cookie exists, when the browser is first directed to a URL, why can Beaker (or whichever component is involved) read the cookie? If it had read the cookie, session['some_var'] would be available. I'm not sure I understand what you're talking about either. The code sample you originally included could be translated like so: If there's a cookie already present: do something with it otherwise, when no cookie is around: do something else On the first visit to the web page, of course there isn't a cookie YET, its the first visit after all. So the second if statement runs. On the second visit, since they've been there before, there's a cookie present, so the first if statement runs. This seems obvious enough, I'm not sure where the confusion is? I think perhaps what he is expecting is a persistent cookie -- which is not what sessions and session cookies are all about? Thorsten --~--~-~--~~~---~--~~ 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 pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: What I've learned deploying pylons
Do you mean better mod_wsgi documentation as part of the Pylons documentation, or that mod_wsgi itself needs better/more documentation? I guess I mean better or more complete example is probably a better choice of words rather then documentation because as you already mentioned mod_wsgi has good docs I second that. I think Graham has written a ton of good stuff and has provided first rate support on mailing lists, but ... for cases where the user reading is not nears as experienced as the author, the docs are a bit overwhelming technically. I've found that when I'm wading through stuff that's over my head, lots of simple examples are my favourite bit, even if they seem redundant and pedantic to the author. Rest assured, someone needs them! ;-) Iain --~--~-~--~~~---~--~~ 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 pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---