#11264: "from django.db import models" clobbered in functions inside 
__init__.py of
installed apps
----------------------------+-----------------------------------------------
 Reporter:  akaihola        |       Owner:  nobody    
   Status:  new             |   Milestone:            
Component:  Core framework  |     Version:  SVN       
 Keywords:  importing       |       Stage:  Unreviewed
Has_patch:  0               |  
----------------------------+-----------------------------------------------
 If an app `myapp` has the following `__init__.py`:

 {{{
 from django.db import models
 def myfunc():
     assert models.__package__ == 'django.db.models', (
         'models is %r instead of django.db.models' % models)
 }}}

 then calling `myapp.myfunc()` throws:

 {{{
 AssertionError:
   models is <module 'models_clobber_test_app.models' from
 'myapp/models.pyc'>
   instead of django.db.models
 }}}

 This happens only if
  * `myapp` is in INSTALLED_APPS
  * `myfunc` is in `myapp/__init__.py`, not some other module in it
  * Django is r10088 or later (thanks, git bisect)

 This breaks at least Satchmo from a few months back for me, probably trunk
 too.

 r10088 claims to have fixed all dynamic imports in Django by backporting
 `importlib` from Python 2.7.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/11264>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to