[mod_python] Conflit with same different Session IDs

Graham Dumpleton graham.dumpleton at gmail.com
Thu Dec 20 18:52:13 EST 2007


Or use a cookie path. See:

  http://www.modpython.org/live/current/doc-html/pyapi-sess-classes.html

In particular:

  mod_python.session.application_path

option.

Ensure this option is set differently for each application URL context
using Location directive.

Graham

On 21/12/2007, Greg Fawcett <greg at vig.co.nz> wrote:
> If your sessions rely on cookies (most do) then you can resolve your session
> conflicts by using different domains - this will force browsers (all
> browsers - you probably need to cater for more than just Firefox) to create
> a new cookie/session. So set up appa.mydomain.co.nz for appa, and
> appb.mydomain.co.nz for appb.
>
> I think your first question about module names and sessions should wait for
> wiser heads than mine, but I doubt that it is the module conflict that is
> breaking pickle in sessions.
>
> Cheers!
> Greg.
>
>
> On 21/12/2007, S.R.Pardá <linux at qbox.es> wrote:
> > Hi.
> >
> > 1.- I will explain what I'm doing to understand me better:
> >
> > I'm trying to have various modpython applications that shared some
> > modules (like libraries) and with others modules with little
> > differences.
> > I wrote about problems with module names coincidence between
> > applications.
> > Using import_module seems capable of load them when needed, but losing
> > the pickle abbility for using session for data persistence.
> >
> > Now, I have modified the modules path, so modules shared among
> > applications now resides in different packages so I import them with:
> >
> >         from appApack import users
> > or
> >         from appBpack import users
> >
> > And modpython apache session now works ok.
> >
> > ¿ Do you think thats is well done ?
> >
> >
> >
> >
> > 2.- Now I realized of one hidden problem appears that i haven't in
> > count:
> >
> > Because in Firefox the same session ID is used for different tab and
> > browsers. Data stored in sessions, is used between applications.
> >
> > So, if I store an instance of class User in session['activeUser'], it is
> > retrieved by application A and application B.
> >
> > But now, I received an error, when application B, try to retrieve an
> > object from session['activeUser']:
> >
> >         ImportError: No module named appApack.users
> >
> > That's because when it tries to retrieve an user of appBpack instead it
> > receives an instance of class User in appApack stored in the session
> > with the same name 'activeUser'.
> >
> > Now the error is obvious, because the pack A doesn't exist in
> > application B paths, and I use the import.
> > Previously I tried with import_module and received an error trying to
> > import  _mp_62617189222202272 , that was not so clear. So I discarted
> > import_module.
> >
> >
> >
> > ¿ What can I do to solve that problem easily?
> >
> >         (I know I can prefix all session names with 'AppA_' or 'AppB_')
> >
> >
> > ¿ Can I change session ID handling in Firefox ?
> >
> >
> >
> >
> >
> >
> >
> >
> > _______________________________________________
> > Mod_python mailing list
> > Mod_python at modpython.org
> > http://mailman.modpython.org/mailman/listinfo/mod_python
> >
>
>
>
> --
> Phone: +64 3 409 8165
> Mobile: +64 21 333 291
> Fax: +64 3 974 6810
> Web: www.vig.co.nz
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python
>
>



More information about the Mod_python mailing list