python - Retrieving information stored in other sessions with gae-sessions -


i made simple login system gae-sessions, , want show logged in user how many users logged in , are.

to count number of people logged in, when log user in save session datastore save(persist_even_if_using_cookie=true). use sessionmodel.all().count() retrieve number of logged in accounts.

i'm having trouble retrieving information on other sessions though. i'm not sure how it. tried this:

logged_in = [] activesession in sessionmodel.all():     logged_in.append(activesession['user']) 

but i'm getting error:

typeerror: 'sessionmodel' object unsubscriptable 

i tried activesession.get('user'), results in error:

badkeyerror: invalid string key user. 

how can this?

the session object , sessionmodel separate each other. sessionmodel stores contents of session, can't read session object.

i have feeling bad idea, , should find way store/retrieve list of logged in users. method may return expired sessions haven't been deleted yet, , slow.

the method want call __decode_data. think work:

for activesession in sessionmodel.all():     data = session._session__decode_data(activesession.pdump)     logged_in.append(data['user']) 

Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -