Re: ImportError catching in urlresolvers.py

2011-06-16 Thread Russell Keith-Magee
On Thu, Jun 16, 2011 at 3:09 PM, Bas Peschier wrote: > For reference, I added a patch to https://code.djangoproject.com/ticket/10802 > which takes Russell's approach. Looks good to me! I've just marked to RFC. Thanks for the patch Bas! Yours, Russ Magee %-) -- You received this message because

Re: ImportError catching in urlresolvers.py

2011-06-16 Thread Bas Peschier
For reference, I added a patch to https://code.djangoproject.com/ticket/10802 which takes Russell's approach. -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com. To unsubs

Re: ImportError catching in urlresolvers.py

2011-06-15 Thread Thomas Guettler
On 14.06.2011 22:19, Michael Blume wrote: > In RegexURLPattern._get_callback, we attempt to fetch the callable named > by the URL pattern, and catch a possible ImportError if this fails. If > so, we raise ViewDoesNotExist. > > try: > self._callback = get_callable(self._callback

Re: ImportError catching in urlresolvers.py

2011-06-15 Thread Bas Peschier
On 15 jun, 07:36, Russell Keith-Magee wrote: > In this case, the underlying problem is that ImportError is actually > catching 2 different errors: >  1) The view specified doesn't exist >  2) The module containing the view contains an error. Agreed, in this case this information is lost in get_

Re: ImportError catching in urlresolvers.py

2011-06-14 Thread Russell Keith-Magee
On Wed, Jun 15, 2011 at 1:31 PM, burc...@gmail.com wrote: > Hi Russell, > > and what do you say about showing call stack properly? > > The problem is not ViewDoesNotExist itself, but throwing away useful > traceback. > > If we do instead: >    import sys >    try: >        self._callback = get_ca

Re: ImportError catching in urlresolvers.py

2011-06-14 Thread burc...@gmail.com
Hi Russell, and what do you say about showing call stack properly? The problem is not ViewDoesNotExist itself, but throwing away useful traceback. If we do instead: import sys try: self._callback = get_callable(self._callback_str) except ImportError, e: mod_name, _ =

Re: ImportError catching in urlresolvers.py

2011-06-14 Thread Russell Keith-Magee
On Wed, Jun 15, 2011 at 11:51 AM, David Cramer wrote: > This is currently a problem all over in the Django codebase, and I'd > love to see a generic/reusable approach at solving this everywhere. We already have a generic/reusable approach -- it's just not used everywhere that it could be used. A

Re: ImportError catching in urlresolvers.py

2011-06-14 Thread David Cramer
This is currently a problem all over in the Django codebase, and I'd love to see a generic/reusable approach at solving this everywhere. On Jun 14, 1:19 pm, Michael Blume wrote: > In RegexURLPattern._get_callback, we attempt to fetch the callable named by > the URL pattern, and catch a possible I