On Tue, 2008-07-08 at 16:20 -0700, Julien Phalip wrote:
> Hi,
> 
> There's an issue that arose as I upgraded an external app of mine to
> newforms-admin.
> 
> I created the conventional admin.py, which does all the registration
> business, and did "import admin" in the module's __init__.py
> 
> After I did that, I got some import errors at compilation time (or
> say, project's launching time):
> 
> "ImportError: cannot import name MenuItem"
> 
> "MenuItem" is in the external app (freshly upgraded to nfa), and the
> import that raises the error is made in the project's app.

It's a bit (for me, at least) to keep track of what structure you're
describing here. You are using the word "project" to mean something that
isn't clear. Could you give a small layout of the directory structure
please.

It's not impossible to imagine something like the problem you're
describing happening depending upon import paths. Remember that when you
do "from foo import models", Python first has to parse and execute the
code in "foo/__init__.py", so things might not be fully constructed.
But, again, it's hard to tell without concrete code. If you can
construct a very small example that demonstrates the problem (like,
literally, as few lines as possible. To the point that if you remove any
more lines, the problem goes away) then you've got something you can put
in a bug report because then other people can try to repeat the problem
and diagnose it.

I'm not intimately familiar with how newforms is doing imports or
recommended practices over there, but if this type of problem is
cropping up, it's worth knowing about it so that we can either document
"don't do that" or get things fixed if possible.

Again, I'm not saying that what you're seeing is a bug or necessarily a
problem in Django. I don't understand the problem you're describing from
the English-language version. Code speaks more clearly here, I think.

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