Hello all,


Is there anybody who can help me out on this ?

regards




 

Laxmikant Gurnalkar

Team Lead - R&D



*GSM Mobile (Voice & Data): +91-9767547164

*Tel: +91-22-40212598 I *Fax:+91-22-40212596

*E- Mail: [email protected] *Web: http://www.vvidia.tv
<http://www.vvidia.tv/> 

 

P Please don't print this e-mail unless you really need to, this will
preserve trees on planet earth. 

----------------------------Disclaimer--------------------------------------
----------------------------------------------------------------------------
----------------------------------------------------------------------------
---------

The information contained in this message (including any attachments) is
confidential and may be privileged. If you have received it by mistake
please notify the sender by return e-mail and permanently delete this
message and any attachments from your system. Please note that e-mails are
susceptible to change and malwares. VVIDIA COMMUNICATIONS PVT LTD.
(including its group companies) shall not be liable for the improper or
incomplete transmission of the information contained in this communication
nor for any delay in its receipt or damage to your system. 

----------------------------------------------------------------------------
---------------------------------------------Disclaimer---------------------
----------------------------------------------------------------------------
---------

 

From: [email protected]
[mailto:[email protected]] On Behalf Of Laxmikant Gurnalkar
Sent: Sunday, August 25, 2013 4:47 PM
To: [email protected]
Subject: HTTPFound not showing message on the jinja2 template

 


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]
<mailto:[email protected]> .
To post to this group, send email to [email protected]
<mailto:[email protected]> .
Visit this group at http://groups.google.com/group/pylons-discuss.
For more options, visit https://groups.google.com/groups/opt_out.

-- 
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.

<<image001.jpg>>

Reply via email to