On Wed, 2007-04-18 at 09:34 -0700, Andrew Durdin wrote:
> On Apr 18, 4:27 am, Malcolm Tredinnick <[EMAIL PROTECTED]>
> wrote:
> >
> > The problem is that "import all apps" is not a simple operation and has
> > lots of unexpected (at least until you get used to expecting the
> > unexpected) side-effects. Nested imports are the main cause. :-)
> >
> > The problem is that if application A imports something from application
> > B and application B is also in the list of INSTALLED_APPS (which it
> > would have to be in almost all cases), whilst the import of B is first
> > being done, the sys.modules entry for A will be empty (it will have a
> > key of "A" and a value of None) so that multiple imports don't happen.
> 
> This could perhaps be worked around by requiring that apps not import
> other apps at the top level in their __init__.py module...  I don't
> expect that's likely to cause much incompatibility, but I'm sure
> there'd be some.

One problem with this approach is that it's basically saying "you can't
use Python as it's intended to be used", which I would see as a bit of a
showstopper. It's not just in the __init__.py function. It means you
can't do "from sites.models import SomeModel" or similar things. That
would require quite a change to a fairly common Python programming
style.

Regards,
Malcolm



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to