Closed Bug 672545 Opened 13 years ago Closed 12 years ago

Create a class-based view cache decorator

Categories

(Webtools Graveyard :: Elmo, defect, P5)

defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: Pike, Assigned: peterbe)

References

Details

Attachments

(1 file)

In bug 650816, I'm kinda hacking around that fact that the cache decorator doesn't work for view classes.

peterbe would like this to look somewhat like

# urls.py

  url('/foo', FooView.as_view(), name='foo')

# views.py

@cache_control_view(max_age=60)
class FooView(View):
  def get(self)
Priority: -- → P5
Actually, it doesn't look like a huge win. However, with this in place we can start adding more decorators later.
Attachment #632061 - Flags: review?(l10n)
Comment on attachment 632061 [details] [diff] [review]
This is much neater

Review of attachment 632061 [details] [diff] [review]:
-----------------------------------------------------------------

I think there's a left-over import below, r=me with that fixed, or explained.

::: apps/shipping/views/status.py
@@ +4,4 @@
>  
>  '''Views for shipping metrics.
>  '''
> +from collections import defaultdict

Does that belong into this patch?
Attachment #632061 - Flags: review?(l10n) → review+
(In reply to Axel Hecht [:Pike] from comment #2)
> Comment on attachment 632061 [details] [diff] [review]
> This is much neater
> 
> Review of attachment 632061 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> I think there's a left-over import below, r=me with that fixed, or explained.
> 
> ::: apps/shipping/views/status.py
> @@ +4,4 @@
> >  
> >  '''Views for shipping metrics.
> >  '''
> > +from collections import defaultdict
> 
> Does that belong into this patch?

Not really. I moved it where it belongs (e.g. before app specific imports) but I also had a bunch of other python imports that I needed for my own development which I later didn't need when I wrapped things up. Lastly, I didn't bother moving it back when I realised there was no real change. Sorry that it confused the patch with noise.
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Assignee: nobody → peterbe
Target Milestone: --- → 2.2
Product: Webtools → Webtools Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: