Zope 2.7.2 win32 - Sessions not working

K

Kyle Yancey

I've scratched my chin over this for the longest time. I think I'm
going to need some help. I'm creating a web app with zope. It has a
typical user login based on email and password. A ZSql method is
called to look up the customers unique id. That id is then assigned
to their session cookie so I can allow to them to go to an account
page where they can change their preferences. Unfortunately, zope
sessions just don't seem to be working at all. I know something is
being assigned, because Transient Object Container session_data says
that it contains 8 items even though I only tried to set one. Any
help would be appreciated.

request = container.REQUEST
response = request.RESPONSE
session = request.SESSION

html_page = """<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0
Transitional//EN">
<html><head><title></title>
<meta http-equiv="REFRESH" content="0;url=/Account"></HEAD>
<BODY></BODY></HTML>"""
if session.has_key('id'):
return html_page

if request.REQUEST_METHOD == 'POST':
rec = context.Sql.get_user_id(email = email, password = password)
if rec:
cust_id = rec.dictionaries()[0]['cust_id']
session.set('id', cust_id)

return html_page
 
I

Istvan Albert

Kyle said:
I've scratched my chin over this for the longest time. I think I'm
going to need some help. I'm creating a web app with zope. It has a
typical user login based on email and password. A ZSql method is
called to look up the customers unique id. That id is then assigned

Just an observation, in your example you seem to try to go
the account page even when the login fails (no records)...

Istvan.
 
K

Kyle Yancey

Sorry for not replying for so long. I've been busy. I just gave up on
Zope sessions and used FSSession. It is poorly documented, but at
least it works. The Account page will redirect to the Login page if
no cookie is assigned. The login page should always redirect to the
account page with an assigned cookie.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top