durusmail: quixote-users: {get,set}_session_manager()
{get,set}_session_manager()
2002-05-15
2002-05-15
Multi-threaded Quixote apps (was Re: {get,set}_session_manager())
2002-05-16
2002-05-16
2002-05-16
2002-05-16
2002-05-16
{get,set}_session_manager()
Greg Ward
2002-05-15
I just noticed that Quixote's session.py maintains a global
SessionManager instance, which is accessed via get_session_manager() and
set_session_manager().  There are a couple of other functions for
accessing sessions in the global session manager: get_session(),
has_session(), and get_app_state().

I'm quite sure that keeping a global session manager is wrong: we
already keep a global Publisher instance (in publish.py), and the
SessionManager there (when the Publisher instance is actually a
SessionPublisher) should be the One True SessionManager.  In fact,
quixote.session.get_session_manager() only works if you have previously
called quixote.session.set_session_manager(), even though the One True
SessionManager is already available via the global Publisher instance.
It's just wrong to have these globals in multiple places.

But that's an implementation detail: the important thing is the
interface.  Would anyone be unduly inconvenienced if I removed any or
all of:
  * quixote.session.get_session_manager()
    (could easily be replaced in publish.py)
  * quixote.session.set_session_manager()
    (does not make any sense and will not be replaced)
  * quixote.session.get_session()
    (already replaced in publish.py)
  * quixote.session.has_session()
    (could easily be replaced in publish.py)
  * quixote.session.get_app_state()
    (could easily be replaced in publish.py)
?

Our web site uses {get,set}_session_manager(), but I'll fix that if I
remove these.

        Greg

P.S. yes, this does mean I've been writing docs on Quixote session
management.  It's impossible to write docs without doing some
code cleanup...

--
Greg Ward - software developer                gward@mems-exchange.org
MEMS Exchange                            http://www.mems-exchange.org


reply