Is there an opposite of 'authenticated' in Pyramid?
That is, a way to check that a user is not authenticated in order to restrict access to a login form? I understand that I can do redirects in the view or remove elements in the template depending on whether there is a user set, just wondering if there is a way to do it at the route config level. Thanks, Ben -- 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: Is there an opposite of 'authenticated' in Pyramid?
Append user object to request object. from pyramid.decorator import reify from pyramid.request import Request from pyramid.security import unauthenticated_userid class RequestWithUserAttribute(Request): @reify def user(self): userid = unauthenticated_userid(self) if userid is not None: return Users.by_id(userid) def main(global_config, **settings): config.set_request_factory(RequestWithUserAttribute) def login(request): if request.user: # User is logged in already so redirect else: # Handle the login provide login form On Mon, Sep 26, 2011 at 11:36 AM, Benjamin Sims benjamins...@gmail.comwrote: That is, a way to check that a user is not authenticated in order to restrict access to a login form? I understand that I can do redirects in the view or remove elements in the template depending on whether there is a user set, just wondering if there is a way to do it at the route config level. Thanks, Ben -- 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. -- -- Regards, Bruce Wade http://ca.linkedin.com/in/brucelwade http://www.wadecybertech.com http://www.warplydesigned.com http://www.fitnessfriendsfinder.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.
Running HTTPS Locally
I am running Pylons on my locally machine using Paste server. In my configuration file I have set the following: use = egg:Paste#http host = 127.0.0.1 port = 5000 ssl_pem = * This works for the main page (https://localhost:5000/), however, when I do any redirect to another page, the page drops port 5000 for 443 but the page is no longer found. Is there a way to configure the HTTPS port in Paste? Thanks for your help! -Vincent -- 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: [Paste] Pyramid on Python 3.2
Hi Tornado is ready for py3. I checked out running pyramid py3 on tornado. https://gist.github.com/1244224 -- aod...@gmail.com Sent with Sparrow (http://www.sparrowmailapp.com) 日付:2011年9月26日月曜日、時刻:10:07、差出人:Rick Harding: On Mon, 26 Sep 2011, Sebastien Douche wrote: On Mon, Sep 26, 2011 at 02:45, Mike Orr sluggos...@gmail.com (mailto:sluggos...@gmail.com) wrote: We need a standalone HTTP server of some sort to run out of the box. If not paste.httpserver, what then? gunicorn?[1] [1] http://gunicorn.org/ -- Sebastien Douche sdou...@gmail.com (mailto:sdou...@gmail.com) Twitter : @sdouche I've used swanging for some wsgi testing when working in middleware before and seems to have worked well enough. It's in pypi. http://pypi.python.org/pypi/Spawning/0.7 -- Rick Harding @mitechie http://blog.mitechie.com http://lococast.net -- 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 (mailto:pylons-discuss@googlegroups.com). To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com (mailto:pylons-discuss+unsubscr...@googlegroups.com). For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en. -- 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: Is there an opposite of 'authenticated' in Pyramid?
On Mon, Sep 26, 2011 at 1:36 PM, Benjamin Sims benjamins...@gmail.comwrote: That is, a way to check that a user is not authenticated in order to restrict access to a login form? Restricting access is done via Pyramid's use of ACLs (mapping a user's principals to permissions). This means that you need a way to map a principal X to permission 'not_logged_in'. Principal X could be pyramid.security.Everyone, but obviously that also includes Authenticated users. If you are using one of Pyramid's default authn policies with a callback, it's not going to be possible to build that restriction into the list of principals and you would have to do it through a custom authorization policy. However, it's very easy to implement your own authentication policy and modify the effective_principals(request) function to do exactly what you want. The link below shows how to build a custom authentication policy. https://docs.pylonsproject.org/projects/pyramid_cookbook/dev/authentication.html#custom-authentication-policy -- Michael -- 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.