Opened 17 years ago

Closed 17 years ago

#6393 closed (wontfix)

Example of wrapping a generic method could be better

Reported by: garth Owned by: nobody
Component: Documentation Version: dev
Severity: Keywords: auth, generic views
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

The example of wrapping a generic method in a login decorator is shown below

from django.views.generic.date_based import object_detail

@login_required
def limited_object_detail(*args, **kwargs):
    return object_detail(*args, **kwargs)

It is probably much easer and cleaner to do

from django.views.generic.date_based import object_detail

limited_object_detail = login_required(object_detail)

Change History (1)

comment:1 by Malcolm Tredinnick, 17 years ago

Resolution: wontfix
Status: newclosed

I'd prefer to leave this at it is. Your change only works in this particular case, whereas the more general form in the documents gives people the push to remind that it's "just a function" and they can put whatever they like in there.

Note: See TracTickets for help on using tickets.
Back to Top