Jacob Kaplan-Moss

Backwards compatibility

I wrote this post in 2010, more than 12 years ago. It may be very out of date, partially or totally incorrect. I may even no longer agree with this, or might approach things differently if I wrote this post today. I rarely edit posts after writing them, but if I have there'll be a note at the bottom about what I changed and why. If something in this post is actively harmful or dangerous please get in touch and I'll fix it.

Backwards compatibility is pain sometimes:

# We need backwards compatibility with code which spells it this way:
#   def my_view(): pass
#   my_view = cache_page(my_view, 123)
# and this way:
#   my_view = cache_page(123)(my_view)
# and this:
#   my_view = cache_page(my_view, 123, key_prefix="foo")
# and this:
#   my_view = cache_page(123, key_prefix="foo")(my_view)
# and possibly this way (?):
#   my_view = cache_page(123, my_view)