using session like a dictionary - setting primitive values

3 views
Skip to first unread message

dhruvg

unread,
Dec 29, 2009, 8:22:29 PM12/29/09
to appengine-utilities
hi.

i am using gae-utilities, specifically the session storage features.
it is working well, though i am facing one issue:

i am unable to set key-value pairs in the session object where the
value is a primitive (not a Model).

for example, if i have a session like self.sess, and i specify:

self.sess['logged_in'] = True;

True is not a model, it is a boolean.

when i look in the datastore for app engine, the value stored for the
key name logged_in is <null>. however, the other keys which have
corresponding models as their value are stored properly.

is there a way to support storage of primitive types in the session
dictionary?

dhruvg

unread,
Dec 29, 2009, 9:11:44 PM12/29/09
to appengine-utilities
nvm... i figured the data is stored in the content column (not model)
in sha-1 encrypted form.

Joe Bowman

unread,
Dec 29, 2009, 9:42:23 PM12/29/09
to appengine-utilities
Correct, the model property is the reference to the Session model for
the session. Basically, there's 2 models involved, one for the
session, and another for the data. Each key/value gets it's own
object, that references the session object. This was done in order to
avoid indexing issues, and increase the amount of data you can store
in the session.

The data isn't sha1 encrypted... that would be way too heavy. The data
is pickled and stored as a BlobProperty. The only thing I can think of
is that for some reason boolean properties are not getting pickled
properly.

I'd suggest filing an issue with some example code on the github
project and see if anyone is interested in picking it up. Currently,
I'm too heavily involved in other projects to invest any time into
this library, as I'm not using appengine any longer.

Reply all
Reply to author
Forward
0 new messages