Opened 9 years ago

Closed 9 years ago

#12080 closed (invalid)

Decorator used, without the decorator syntax

Reported by: v21 Owned by: nobody
Component: Documentation Version: 1.1
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


under , there is the following code:

from django.db.models import permalink

def get_absolute_url(self):
    return ('people_view', [str(])
get_absolute_url = permalink(get_absolute_url)

which should surely be:

from django.db import models

def get_absolute_url(self):
    return ('people_view', [str(])

(I also changed the import statement to be more consistent with the previous code snippet.)

Change History (1)

comment:1 Changed 9 years ago by Luke Plant

Resolution: invalid
Status: newclosed

Decorator syntax is not a requirement, and doesn't work with Python < 2.4. Since we are dropping Python 2.3 support for Django 1.2, we can of course now use decorator syntax, but it makes more sense to do this either:

  • as and when we come across it in the code and are committing related work.
  • or en masse, fixing multiple instances across the code base.

For now, I'm not sure what the best thing to do is. Personally I think it's better to just ignore this in existing code, otherwise it will make backporting bug fixes to the 1.1 branch harder than it needs to be — the 1.1 branch of course must still be compatible with Python 2.3.

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