Brian and I looked briefly at testing for the modules existence using the imp module, and that may yet happen, but for know, be aware of your own code.
On Jul 21, 5:47 pm, "James Bennett" <[EMAIL PROTECTED]> wrote: > On Mon, Jul 21, 2008 at 4:12 PM, Amit Ramon <[EMAIL PROTECTED]> wrote: > > autodiscover() goes over INSTALLED_APPS and tries to import their admin > > modules. When such a module isn't present, ImportError is caught and > > consumed. However, if some admin module do exists, but for some reason it > > throws an ImportError (e.g., it tries to load a non-existing module), it > > will not be loaded and will not be seen in the admin interface, without any > > significant notice. To me this seems like an undesired side-effect, perhaps > > even a bug. > > This is a well-known side effect of anything which needs to import > something which might not exist: it is nearly impossible to write > robust code that can correctly differentiate: > > 1. An ImportError raised by a non-existent module > 2. A module which exists but whose initialization raises an ImportError > > The solution is to test your code independently and ensure that it > functions correctly before attempting to use it (e.g., write a unit > test which attempts to import your admin declarations and fails if an > exception is raised in the process; if this test passes, you can rest > easy). > > -- > "Bureaucrat Conrad, you are technically correct -- the best kind of correct." --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to [email protected] 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 -~----------~----~----~----~------~----~------~--~---

