Opened 16 years ago
Closed 16 years ago
#10979 closed (fixed)
FixedOffset.__repr__ is misleading for negative offsets
| Reported by: | George Song | Owned by: | George Song |
|---|---|---|---|
| Component: | Core (Other) | Version: | dev |
| Severity: | Keywords: | tzinfo | |
| Cc: | Triage Stage: | Ready for checkin | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
If you pass a negative offset to FixedOffset, the tzinfo representation is misleading:
>>> from django.utils.tzinfo import FixedOffset >>> tz = FixedOffset(-510) >>> tz -0930
The attached patch simply calculates the hours as a float, which yields the more correct representation.
>>> from django.utils.tzinfo import FixedOffset >>> tz = FixedOffset(-510) >>> tz -0830
Attachments (2)
Change History (7)
by , 16 years ago
| Attachment: | utils_tzinfo-r10651.patch added |
|---|
comment:1 by , 16 years ago
| Needs documentation: | set |
|---|---|
| Needs tests: | set |
| Triage Stage: | Unreviewed → Accepted |
by , 16 years ago
| Attachment: | 10979-utils_tzinfo-r10651.patch added |
|---|
Updated patch with additional fixes and tests
comment:2 by , 16 years ago
| Needs tests: | unset |
|---|---|
| Owner: | changed from to |
| Status: | new → assigned |
Good call on the tests as I caught additional cases. I'm not sure what kind of documentation is needed as needs_docs is set to 1.
comment:3 by , 16 years ago
| Needs documentation: | unset |
|---|
The needs_docs was me being retarded. I was only to set needs_better_patch in that column.
comment:4 by , 16 years ago
| Triage Stage: | Accepted → Ready for checkin |
|---|
comment:5 by , 16 years ago
| Resolution: | → fixed |
|---|---|
| Status: | assigned → closed |
Note:
See TracTickets
for help on using tickets.
You appear to have left off the portion of the patch that changes the tests. :-)