Changes between Initial Version and Version 1 of Ticket #13093


Ignore:
Timestamp:
03/11/2010 07:44:21 PM (5 years ago)
Author:
russellm
Comment:

Forgot to mention: Thanks to Brian Neal for the report.

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #13093

    • Property Patch needs improvement unset
    • Property Triage Stage changed from Unreviewed to Accepted
    • Property Needs tests unset
    • Property Needs documentation unset
  • Ticket #13093 – Description

    initial v1  
    11The cache_page() decorator works fine on views, but fails if you use it on a callable class::
    2 class:
    32{{{
    43class MyView(object):
     
    76}}}
    87
    9 If you try to wrap this view in urls.py ({{{ cache_page(MyView(), 60) }}}), you get an error saying "MyView doesn't have attribute __name__". cache_page uses the __name__ attribute to build a cache key, but classes dont have a __name__ attribute. cache_page should also check for __class__.__name__ (or some similar key with a per-instance feature) to allow for wrapping callable classes.
     8If you try to wrap this view in urls.py ({{{ cache_page(MyView(), 60) }}}), you get an error saying "MyView doesn't have attribute !__name!__". cache_page uses the !__name!__ attribute to build a cache key, but classes dont have a !__name!__ attribute. cache_page should also check for !__class!__.!__name!__ (or some similar key with a per-instance feature) to allow for wrapping callable classes.
    109
    1110This is a problem for 1.2, because feed views have been moved to a class-based structure, so it is no longer possible to cache feed views using cache_page().
Back to Top