Opened 11 years ago

Closed 10 years ago

Last modified 10 years ago

#688 closed defect (fixed)

[patch] Error handlers lack context.

Reported by: wojtek@… Owned by: Adrian Holovaty
Component: Translations Version: 0.90
Severity: critical Keywords: errors handlers 404 500
Cc: django@… Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

Which isn't nice because often one sets various extra_context variables for the views in the middleware. And the 404 view could be using a template which requires some variables from the context (for example name of the currently logged in user).

So it would be nice if page_not_found in django/views/defaults would pass the extra_context variables when rendering the 404.html template.

Attachments (1)

error-handlers.diff (821 bytes) - added by James Wheare <django@…> 10 years ago.
Allows error handlers to benefit from context processors

Download all attachments as: .zip

Change History (19)

comment:1 Changed 11 years ago by Adrian Holovaty

Where would page_not_found get the extra_content? I'm not sure this is possible...

comment:2 Changed 11 years ago by Adrian Holovaty

Resolution: invalid
Status: newclosed

Marking as invalid (see my previous comment).

comment:3 Changed 10 years ago by James Wheare <django@…>

Cc: django@… added
Keywords: errors handlers 404 500 added
Resolution: invalid
Status: closedreopened
Type: defectenhancement

Yep it's possible, you just need to change the context of the view to a RequestContext. Here's a patch, or you can write your own custom view.

Changed 10 years ago by James Wheare <django@…>

Attachment: error-handlers.diff added

Allows error handlers to benefit from context processors

comment:4 Changed 10 years ago by James Wheare <django@…>

Summary: Default 404 handler uses no context.[patch] Error handlers lack context

comment:5 Changed 10 years ago by Adrian Holovaty

Resolution: fixed
Status: reopenedclosed

(In [3179]) Fixed #688 -- Changed default 404 and 500 views to use RequestContext

comment:6 Changed 10 years ago by anonymous

Component: Core frameworkTranslations
priority: normalhighest
Severity: normalcritical
Type: enhancementtask
Version: 0.9

comment:7 Changed 10 years ago by anonymous

hello!

comment:8 Changed 10 years ago by Wynefrede

Summary: [patch] Error handlers lack contextsmart+question
Type: taskdefect

preved

comment:9 Changed 10 years ago by Leonard

preved

comment:10 Changed 10 years ago by Christean

preved

comment:11 Changed 10 years ago by Katheryne

preved1

comment:12 Changed 10 years ago by Avis

preved2

comment:13 Changed 10 years ago by Constance

preved3

comment:14 Changed 10 years ago by Judith

preved3

comment:15 Changed 10 years ago by Jeffrye

hello mega!

comment:16 Changed 10 years ago by Jeames

hello mega!

comment:17 Changed 10 years ago by Wynefrede

hello mega!

comment:18 Changed 10 years ago by Chris Beaven

Summary: smart+question[patch] Error handlers lack context.

fixing spammed summary

Note: See TracTickets for help on using tickets.
Back to Top