Issue Details (XML | Word | Printable)

Key: MODPYTHON-11
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Nicolas Lehuen
Reporter: Graham Dumpleton
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
mod_python

Cross contamination of modules

Created: 28/Jan/05 06:00 PM   Updated: 05/Mar/06 01:37 PM
Component/s: None
Affects Version/s: 3.1.3
Fix Version/s: 3.2.7

Time Tracking:
Not Specified

Resolution Date: 30/Apr/05 03:47 PM


 Description  « Hide
This carries on from MODPYTHON-10. In fixing MODPYTHON-10, this problem
is likely to be addressed. Text taken from mailing list.

Cross contamination of modules
------------------------------

For the above case, change the code in "subdir-1/index.py" to:

  subdir1 = None
  def index():
    return "subdir-1",globals().keys()

and "subdir-2/index.py" to:

  subdir2 = None
  def index():
    return "subdir-2",globals().keys()

Accessing "subdir-1" the result is:

  ('subdir-1', ['index', '__mtime__', '__builtins__',
   '__file__', 'subdir1', '__name__', '__doc__'])

Now accessing "subdir-2" the result is:

  ('subdir-2', ['index', '__mtime__', '__builtins__',
   '__file__', 'subdir2', 'subdir1', '__name__', '__doc__'])

Back to "subdir-1" again:

  ('subdir-1', ['index', '__mtime__', '__builtins__',
   '__file__', 'subdir2', 'subdir1', '__name__', '__doc__'])

Because modules of the same name are reimported on top of the existing
module you can end up with cross contamination of modules in respect of
global variables, functions, class definitions, module imports etc.

The most obvious problem this causes with publisher, is that one can
suddenly have appear in a module a function from a different module. This
function then becomes accessible using an appropriate URL via the module
in which it doesn't belong.

Overall this is annoying and could be problematic for those unaware.

 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Nicolas Lehuen added a comment - 30/Apr/05 03:47 PM
Resolved along with MODPYTHON-9.