[patch] Noisier bugs in context processors
|Reported by:||Owned by:||nobody|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||yes|
Description (last modified by )
I just spent an embarrassingly long time figuring out the cause of "'NoneType' object has no attribute 'has_key'" when rendering a template.
I had a buggy context processor which returned None under some conditions, which then made it onto the context stack.
It seems to me that Context.update could verify that it's getting an object that supports getitem since it counts on that (and give a helpful error if it's not the case), but I understand context needs to be high-performance, and generally update is called for context processors anyway.
Perhaps RequestContext.init could raise a TypeError.
Patch attached. Feel free to ignore if I'm the only one to be bitten by this. :-/
Change History (9)
comment:2 Changed 10 years ago by
|Patch needs improvement:||set|
|Triage Stage:||Unreviewed → Design decision needed|
comment:4 Changed 9 years ago by
|Status:||closed → reopened|