Issue Details (XML | Word | Printable)

Key: MODPYTHON-156
Type: Sub-task Sub-task
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Graham Dumpleton
Reporter: Graham Dumpleton
Votes: 0
Watchers: 0
Operations

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

Module imports from server side includes and new importer.

Created: 09/Apr/06 03:15 PM   Updated: 11/Apr/07 11:41 AM
Return to search
Component/s: importer
Affects Version/s: None
Fix Version/s: 3.3.1

Time Tracking:
Not Specified

Resolution Date: 01/May/06 06:50 PM


 Description  « Hide
With old module importer, where Python*Handler directives are used in a directory context, that directory is added to sys.path. Now where Python code is being used with server side includes in that same directory and code of form:

  module = apache.import_module("xxx")

is used with "xxx.py" also being in the same directory, it will be found due to the directory being added to sys.path.

With the new module importer, the directory isn't added to sys.path and so the module would not be found.

In the case of a handler module (rather than SSI Python code), such a module import would still work, as the new module importer is smart enough to realise that the caller was also imported using the new module importer and thus would look in the same directory first or as necessary, in the directory the Python*Handler directive was specified for. This will not work for SSI code though, as it is not part of an imported module and is eval/exec'd on each page request.

What is thus required is for the global environment in which the SSI code is executed for a specific page, to be automatically marked up in such a way that the new module importer believes it was imported as a module by the new module importer, thus triggering it to look in the same directory for modules.



 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Graham Dumpleton made changes - 25/Apr/06 01:04 PM
Field Original Value New Value
Status Open [ 1 ] In Progress [ 3 ]
Repository Revision Date User Message
ASF #398578 Mon May 01 11:49:03 UTC 2006 grahamd Ensure that when using the new importer, that imports from SSI code look in
same directory as the file being expanded or location that request matches
as appropriate. (MODPYTHON-156)
Files Changed
MODIFY /httpd/mod_python/trunk/lib/python/mod_python/importer.py
MODIFY /httpd/mod_python/trunk/lib/python/mod_python/__init__.py
MODIFY /httpd/mod_python/trunk/lib/python/mod_python/apache.py
MODIFY /httpd/mod_python/trunk/src/include/mpversion.h

Graham Dumpleton made changes - 01/May/06 06:50 PM
Fix Version/s 3.3 [ 12310101 ]
Status In Progress [ 3 ] Resolved [ 5 ]
Resolution Fixed [ 1 ]
Graham Dumpleton made changes - 11/Apr/07 11:41 AM
Status Resolved [ 5 ] Closed [ 6 ]