Hello all,

I am newbie to Pyramid, and  using with Jinja2 templates.

Here I want to display error message on login page like "Invalid login 
credentials.".
But I am not getting message on the template.

This is my code : 

@view_config(route_name='login', renderer='templates/1_0_0_login.html')
def login(request):
    '''Render login temmplate'''
    return dict()

@view_config(route_name='auth', renderer='templates/1_0_1_home.html')
def authenticateUser(request):
    '''check user credentials'''
    session = DBSession
    username = request.params.get('username', None)
    password = request.params.get('password', None)
    if username and password:
        sha = hashlib.md5()
        sha.update(password)
        password = sha.digest().encode('hex')
        user = session.query(uses).filter(and_(users.user_name==username, 
users.password == password)).count()
    else:
        user = 0

    if(user != 0):
        headers = remember(request, username)
        return HTTPFound(location = '/home', headers=headers)
    else:
        url = request.route_url('login', message="Invalid login 
credentials.") 
        return HTTPFound(location=url)



and this is on the template login.html:

  {% if message %}
  <div class="alert alert-info">
  {{message}}
  </div>
  {% endif %}

Could you please let me know, Whats wrong here?

Thanks in advance.

regards,
Laxmikant Gurnalkar

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/pylons-discuss.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to