[mod_python] Conflit with same different Session IDs

S.R.Pardá linux at qbox.es
Thu Dec 20 12:41:43 EST 2007


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 ? 










More information about the Mod_python mailing list