[patch] Context should have the __contains__ method
|Reported by:||Antti Kaihola||Owned by:||Adrian Holovaty|
|Cc:||Triage Stage:||Ready for checkin|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
Context class in django.template.context should have a
__contains__ method defined, so that one can do:
if 'missiles' not in context: raise ImproperlyConfigured, \ 'Please include missiles in the context so we can destroy the world.' destroy_world_with(context['missiles'])
Although, the destroy_world_with function is left as an exercise for the reader.
A simple patch which concerns context.py is included.
Change History (5)
comment:1 Changed 10 years ago by
|Summary:||Context should have the __contains__ method → [patch] Context should have the __contains__ method|