-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Tom,

Thanks for bringing this to the list.

On 09/20/2011 10:32 AM, Tom Christie wrote:
>   I recently bumped into the same issue as reported in #5617
> <https://code.djangoproject.com/ticket/5617>.  (And duplicate #6377
> <https://code.djangoproject.com/ticket/6377>.)
> IE: Django's default 500 view uses a Context, not a RequestContext,
> which means any 500 templates which uses MEDIA_URL or suchlike won't work.
> 
> I thought I'd re-punt the suggestion given in one of the comments -
> attempt to render using the RequestContext, and only fall back to the
> Context if that fails.  It seems like a reasonable approach, but it
> looks like it's something that didn't ever get properly considered,
> because no-one pushed the issue to the list, as far as I can tell.
> 
> Where do we stand on this?  I'd have thought that a large amount of
> installs are having to define their own 500 view function, which does
> nothing more than the default view, other than to use a RequestContext
> so that the template can render correctly.  Would there be any value in
> re-opening the ticket given the suggested fallback approach?

Personally I have always made the 500 page simple and completely
standalone (all CSS inline in the page) so it has no external
dependencies, and have never had a problem with this approach.

The concern I have with the proposed try-and-try-again approach is that
it makes people think they can write a 500 template with all kinds of
dependencies on RequestContext, and then if there is an error that does
actually break one of their context processors, their 500 page will in
all likelihood be horribly broken. I think it's better to encourage 500
pages that are simple all the time rather than beautiful some of the
time and completely broken some of the time.

An approach I'd be more open to considering would be to have the default
handler500 manually inject STATIC_URL into the template context (without
using RequestContext). I think this alone would take care of the vast
majority of issues people have with this, and simply looking up a
setting is no more likely to raise additional errors than the process of
rendering a template itself is (whereas context processors might do
anything). (It shouldn't be MEDIA_URL; since Django 1.3 that setting is
only for user-uploaded media, which is not something that should be
needed on a 500 page).

Thoughts on this?

Carl
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk55DnMACgkQ8W4rlRKtE2czWQCfWXkYN9CznrNd78bD6HtE7fCN
t3kAnRHBK7jjE1LAtKrSSPZkG9OVVGyi
=CJAN
-----END PGP SIGNATURE-----

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" 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-developers?hl=en.

Reply via email to