Opened 13 years ago
Closed 13 years ago
#20019 closed Cleanup/optimization (fixed)
Set `HttpRequest.resolver_match` to `None` by default
| Reported by: | Ram Rachum | Owned by: | nobody |
|---|---|---|---|
| Component: | HTTP handling | Version: | dev |
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Accepted | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | yes | UI/UX: | no |
Description
Sometimes my app has to deal with a request which does not have a .resolver_match object for some reason.
In these cases, I suggest that .resolver_match will have a value of None rather than not existing. This makes for much more elegant testing whether it exists or not.
Trivial patch attached.
Attachments (1)
Change History (4)
by , 13 years ago
comment:1 by , 13 years ago
| Component: | Uncategorized → HTTP handling |
|---|---|
| Type: | Uncategorized → Cleanup/optimization |
| Version: | 1.5 → master |
comment:2 by , 13 years ago
| Easy pickings: | set |
|---|---|
| Triage Stage: | Unreviewed → Accepted |
comment:3 by , 13 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
Django generally creates in
__init__all attributes that may be set later on. I'll set the attribute at the instance level rather than at the class level. This is a small oversight in b946db5241b924c72c1079ce30d9b368e2b82f07.