Uploaded image for project: 'mod_python'
  1. mod_python
  2. MODPYTHON-11

Cross contamination of modules

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 3.1.3
    • 3.2.7
    • None
    • None

    Description

      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.

      Attachments

        Activity

          People

            nlehuen Nicolas Lehuen
            grahamd Graham Phillip Dumpleton
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: