Issue Details (XML | Word | Printable)

Key: MODPYTHON-9
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Nicolas Lehuen
Reporter: Nicolas Lehuen
Votes: 0
Watchers: 1
Operations

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

mod_python.publisher does not support modules with the same name but in different directories

Created: 24/Jan/05 04:13 PM   Updated: 05/Mar/06 01:35 PM
Return to search
Component/s: None
Affects Version/s: 3.1.3
Fix Version/s: 3.2.7

Time Tracking:
Not Specified

Resolution Date: 28/Apr/05 12:54 AM


 Description  « Hide
Using mod_python.publisher, you have two modules :

/index.py
/subdir/index.py

The problem is that due to the way published modules are imported, the resulting behaviour is unpredictable. Sometimes when calling /subdir/index.py the /index.py module is called, and vice versa.

This bug is very annoying because new mod_python users encounter it frequently, and I don't think it gives good press to mod_python.

 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Graham Dumpleton added a comment - 28/Jan/05 05:56 PM
Additional information from the mailing list which clarifies this issue.

Sticky modules obscuring real module
------------------------------------

Create and "index.py", "subdir-1/index.py" and "subdir-2/index.py" all
containing:

  import os
  def index():
    return os.getpid(),__file__

Now cycle through accessing these in the order:

  index.py
  subdir-1/index.py
  index.py
  subdir-2/index.py
  index.py
  subdir-1/index.py
  index.py
  subdir-2/index.py
  ...

In my case this is:

  /~grahamd/publisher
  /~grahamd/publisher/subdir-1
  /~grahamd/publisher
  /~grahamd/publisher/subdir-2
  /~grahamd/publisher
  /~grahamd/publisher/subdir-1
  /~grahamd/publisher
  /~grahamd/publisher/subdir-2
  /~grahamd/publisher
  ...

The result for this is:

  (521, '/Users/grahamd/Sites/publisher/index.py')
  (521, '/Users/grahamd/Sites/publisher/subdir-1/index.py')
  (521, '/Users/grahamd/Sites/publisher/subdir-1/index.py')
  (521, '/Users/grahamd/Sites/publisher/subdir-2/index.py')
  (521, '/Users/grahamd/Sites/publisher/subdir-2/index.py')
  (521, '/Users/grahamd/Sites/publisher/subdir-1/index.pyc')
  (521, '/Users/grahamd/Sites/publisher/subdir-1/index.pyc')
  (521, '/Users/grahamd/Sites/publisher/subdir-2/index.pyc')
  (521, '/Users/grahamd/Sites/publisher/subdir-2/index.pyc')

One can see that once one of the "index.py" files in the subdirectories is
accessed, they become sticky and the latest one accessed from a subdirectory
is returned instead of the top level one when it is accessed.

This one has got to be a bug.

Nicolas Lehuen added a comment - 28/Apr/05 12:54 AM
Done, along with a fix for MODPYTHON-8.