Categories:
Posted by: bjb

I’ve seen this message before: “This system is locked, you’ll be redirected to the unlock dialog in a few seconds.”

This morning that message did not clear up after several minutes (including time to walk to the kitchen and get a glass of water). Finally, I had to open a text terminal, run links, visit my favourite search engine duckduckgo.com, and look up how to fix it. Thank goodness for shell tools and the ability to use them.

The answer is[0]: on the terminal,

loginctl list-sessions
loginctl unlock-session <sessionid>

Works like charm, immediately opened the session.

[0] Answer found at askubuntu. Thank you askubuntu for a useful question and answer that solved my problem in minutes. And for a page that was legible in links, the text-based browser.

Categories: ,
Posted by: bjb

I was looking at django sessions and was a bit confused until I read the source code.

django/contrib/sessions/models.py
django/contrib/sessions/backends/base.py
django/contrib/sessions/backends/db.py
django/contrib/sessions/backends/cache.py
django/contrib/sessions/backends/cached_db.py
django/contrib/sessions/backends/file.py

You might think the interesting file to look at is django/contrib/sessions/models.py, but really the “toplevel” session object is defined in base.py. The object in base.py SessionBase. It is a base class for the various session implementations.

If you’re using a database-backed SessionStore, then you’ll be using base.py, db.py and session.py. db.py uses session.py for the database model and database interaction. In a view, the session object in the request object that is supplied by the session middleware is actually a SessionStore object. That is the object that has the methods get_expiry_age, etc.

I wanted to get some info out of every session in a batch mode including expiry age, so I needed to traverse SessionStore.objects.all(), not Session.objects.all().