On Sep 1, 2011, at 5:47 PM, Joe Barnhart wrote: > I'm having my share of session issues these days. This hour, my > problem is that the variable "response.session_id" does not seem to be > set at the point the model files are executed. > > I am storing sessions in the database (sqlite) to help work around a > problem that manifests as a new session_id for every mouse click and > ajax transaction. One of my tables keeps a "record locator" that is > based on the session_id and I thought I could make it default to it > with default=f(response.session_id). But now the model fails when the > database table is created because session_id is "None". > > I guess my question is, at what point in the transaction may I begin > relying on the session_id? I am not using Auth for this app, but I > need to use the session_id for local continuity of the site.
response.session_id is set at session.connect(), which happens very early in a request (unless you're on GAE, but you're not if you're using sqlite). Are you doing anything with global_settings.db_sessions? If not, it's hard to see how response.session_id could avoid being set.