Changes between Initial Version and Version 4 of Ticket #3192


Ignore:
Timestamp:
09/17/2007 04:46:26 PM (8 years ago)
Author:
jdunck
Comment:

Re-opening for clarification. I'm not fighting the invalid decision, if my point is understood, but ubernostrum suggested that maybe it wasn't.

I agree that a context processor *must* return a dictionary. What I'm trying to address, here, is that it isn't immediately obvious when a bug exists in a context processor which causes it not to return the expected type.

If a context processor returns an object which can't be used as a dictionary, an error does not occur until much later, and then that error 1) kills template rendering rather than using TEMPLATE_STRING_IF_INVALID, and 2) doesn't hint that a context processor may have caused the problem.

...And I'm using hasattr...'getitem' rather than isinstance(..., dict) because Context itself doesn't inherit from dict, and smashing contexts together currently works, so I didn't want the change to start insisting on a dictionary.

Finally, I'm not using "try...except" because Context.update doesn't throw an exception when handed something other than a dictionary-- it happily appends None to the stack of *expected* dictionaries to be checked upon context lookup, i.e. Context.getitem.

Feel free to close as invalid before, but I hope I've made my rationale clearer.

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #3192

    • Property Status changed from new to reopened
    • Property Patch needs improvement set
    • Property Milestone changed from Version 1.0 to
    • Property Triage Stage changed from Unreviewed to Design decision needed
  • Ticket #3192 – Description

    initial v4  
    88
    99Patch attached.  Feel free to ignore if I'm the only one to be bitten by this.  :-/
     10
Back to Top