Opened 16 years ago
Closed 16 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: | no | UI/UX: | no |
Description
under http://docs.djangoproject.com/en/dev/ref/models/instances/#django.db.models.permalink , there is the following code:
from django.db.models import permalink
def get_absolute_url(self):
return ('people_view', [str(self.id)])
get_absolute_url = permalink(get_absolute_url)
which should surely be:
from django.db import models
@models.permalink
def get_absolute_url(self):
return ('people_view', [str(self.id)])
(I also changed the import statement to be more consistent with the previous code snippet.)
Note:
See TracTickets
for help on using tickets.
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:
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.