Hello,
I have wrote a big project on pylons. Unfortunately, I have not test
it enough before deployment. Later I start getting an error.
Address http://siteurl/c/2010_9999 should select client (by the card
number 2010_9999) and write his data to session['SELECTED_CARD'], but
sometimes user gets data from previous session instead of actual or
even data from the session of another user. (Wrong rendered pages
returns faster, like browser cache)
After a long search I am inclined to think that problem is in beaker
session. Maybe it has something to do with the system time as errors
appear about 11am.
I'm storing sessions in the database. I have noticed that if I clean
old sessions from DB at the end of the day, then the next day less
mistakes happens.
Here is 2 controllers - account, customer and the routing rule.
# routing.py
map.connect('/c/{id}', controller='account', action='set_сustomer')
#account.py
def set_сustomer(self, id=None):
if id is None:
abort(404)
else:
num = id.replace('_','/')
# is customer in DB?
try:
Session.query(Customer.num).filter(Customer.num==num).one()
except:
h.flash.set_message(u'Try to import customer from
old DB ' + num)
redirect(url('/account/search'))
else:
session['SELECTED_CARD'] = num
session.save()
redirect(url('/customer')) # redirects after write
session
#customer.py
def index(self):
redirect(url('/customer/view'))
def view(self, id=None):
#HERE IS SOME CODE
return render('/derived/customer/view.mako')
--
You received this message because you are subscribed to the Google Groups
"pylons-discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/pylons-discuss?hl=en.