Hi,
Can't the error be resolved ? Still, if error has to occur then you can put
conditions instead of try blocks for better functioning.
Regards
Naveen Arora
On Monday, 2 March 2020 18:25:15 UTC+5:30, Sencer Hamarat wrote:
>
> Hello,
>
> The project I'm working on has it's custom template context_processor.
> And when unavailable URL request arrives to Django (Eg. "/wp-login.php"),
> the context_processor is throwing AttributeError.
>
> Which way should I use to prevent from context processor from throwing
> errors?
> Is it ok to wrapping return with try block and returning empty dictionary
> if AttributeError raised?
>
> def resolver_context_processor(request):
> return {
> 'app_name': request.resolver_match.app_name,
> 'namespace': request.resolver_match.namespace,
> 'url_name': request.resolver_match.url_name
> }
>
>
>
>
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/77b25608-b663-440c-977c-4fedfd808c8c%40googlegroups.com.