Ticket #250 (closed enhancement: fixed)

Opened 22 months ago

Last modified 22 months ago

Problems with Importing and reloading files

Reported by: nick Owned by: feisley
Priority: critical Milestone: 0.3
Component: Utility Version: 0.3
Keywords: Cc:
Fixed in revision: Branch:
Author:

Description

Django, Pylons and the Google App Engine dev server all have the facility to check the timestamps of all loaded modules to check if any changes have been made since the last request. This allows changes to be made to the code without restarting the server each time.

The Importing module creates a system module that imports the real module when an attribute is accessed on it. According to  PEP 302 custom import modules must define a few attributes (including __name__, __file__ etc.). These attributes are used by the frameworks listed above to determine if the file that the module is based on has changed.

An example: The PyAMF adapter framework currently defines an adapter for Django. If the module django is not imported properly before the reload check is started, all frameworks will throw an error, based on the fact that the modules do not define the correct attributes.

The problem here is that if you attempt to set/get an attribute for the lazily imported module, the whole module is imported, which is not the desired response.

We need to find a way to set the __file__ and __name__ attributes without firing a complete import of the module in question.

Change History

Changed 22 months ago by nick

  • status changed from new to accepted

Changed 22 months ago by nick

  • owner changed from nick to feisley
  • status changed from accepted to assigned

The majority of this ticket is now complete in r1186. One test fails, pyamf.tests.gateway.test_django.TypeMapTestCase.test_objects_all but that is being blocked by #246.

Changed 22 months ago by nick

  • status changed from assigned to closed
  • resolution set to fixed

Merged in r1200.

Note: See TracTickets for help on using tickets.