Opened 15 years ago
Closed 15 years ago
#15604 closed (fixed)
django.db.models.permalink eats docstring
| Reported by: | Simon Law | Owned by: | nobody |
|---|---|---|---|
| Component: | Core (Other) | Version: | 1.2 |
| Severity: | Keywords: | ||
| Cc: | Triage Stage: | Accepted | |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
The django.db.models.permalink decorator eats docstrings, along with the other metadata that it is wrapping. That's because it's not using functools.wraps on its inner function.
It should be defined like this:
from django.utils.decorators import wraps
def permalink(func):
from django.core.urlresolvers import reverse
@wraps
def inner(*args, **kwargs):
bits = func(*args, **kwargs)
return reverse(bits[0], None, *bits[1:3])
return inner
Change History (3)
comment:1 by , 15 years ago
comment:2 by , 15 years ago
| Triage Stage: | Unreviewed → Accepted |
|---|
Good improvement. I'll add this along with some tests.
Note:
See TracTickets
for help on using tickets.
Whoops, that wraps line should be: