Pylons / pyramid_blogr

Pyramid_blogr is an example implementation of Flaskr app with Pyramid Web Framework
72 stars 39 forks source link

Suggestion: authentication form. #5

Closed mauricioschneider closed 9 years ago

mauricioschneider commented 11 years ago

The index.mako template in the authentication topic shows the following code:

<%
from pyramid.security import authenticated_userid
user_id = authenticated_userid(request)
%>

I was wondering if it wouldn't be better to put that code in the views.py file instead, and send just the user_id variable to the template? I mean, to keep things in order.

PS: I'm loving your tutorial, I find it way better and clearer than the official one!

ergo commented 11 years ago

Thanks for kind words, I will move some things around when I update the tutorial to work with python 3.

mikeorr commented 11 years ago

On Thu, Jun 13, 2013 at 12:44 PM, Mauricio Schneider < notifications@github.com> wrote:

The index.mako template in the authentication topichttp://pyramid-blogr.readthedocs.org/en/latest/authentication.htmlshows the following code:

<%from pyramid.security import authenticated_useriduser_id = authenticated_userid(request)%>

I was wondering if it wouldn't be better to put that code in the views.py file instead, and send just the user_id variable to the template? I mean, to keep things in order.

Yes. If an exception occurs during Mako rendering, sometimes the traceback is obscure or completely useless for telling which expression or template line caused it.

Mike Orr sluggoster@gmail.com

ergo commented 9 years ago

this is now obsolete, pyramid 1.5 version of tutorial does this differently :-)