RegistryNotReadyException in django.apps.registry.Apps.check_ready()
|Reported by:||valberg||Owned by:||nobody|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
Instead of using RuntimeError in django.apps.registry.Apps.check_ready(), we should use a django defined exception (possible inheriting from RuntimeError). This way, we can easily catch the exception at the level of occurence, and reraise it with an informative message.
For instance, using django.utils.translation.ugettext in models.py raises a RuntimeError. This does not aid in explaining where the error occurs. Here we could raise RegistryNotReadyException('Use django.utils.translation.ugettext_lazy instead of ugettext').
In the spirit of the new checks framework, let us make it easier for developers to recognize errors and try to inform them how they might be able to fix them. For instance importing ugettext instead of ugettext_lazy in models.py raises an unexplained RuntimeError when running the 'check' command.
Change History (9)
comment:1 Changed 13 months ago by aaugustin
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
comment:3 Changed 13 months ago by aaugustin
- Component changed from Core (Other) to Documentation
- Triage Stage changed from Unreviewed to Accepted
comment:6 Changed 12 months ago by Tim Graham <timograham@…>
- Resolution set to fixed
- Status changed from new to closed