Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#28245 closed Bug (invalid)

timezone.UTC() is not exported, but is attempted to be accessed

Reported by: Christopher Dieringer Owned by: nobody
Component: Uncategorized Version: 1.11
Severity: Normal Keywords: utc, fields, timezone
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

problem statement

timezone.UTC() is called, but no such function is exported.

solution

it seems that mapping timezone.UTC() ==> timezone.utc may be what is desired

how to reproduce

  • send an ISO compliant datetime w/ UTC offset to a DateTimeField(), e.g. 2017-05-30T17:17:21-07:00

stack

the pertinent part of the stack here reveals all:

File "/path/to/rest_framework/fields.py" in to_internal_value

  1.                         return self.enforce_timezone(parsed)

File "/path/to/rest_framework/fields.py" in enforce_timezone

  1.             return timezone.make_naive(value, timezone.UTC())

Exception Type: AttributeError at /rest/v1/api/schedules
Exception Value: module 'django.utils.timezone' has no attribute 'UTC'

Change History (2)

comment:1 by Christopher Dieringer, 8 years ago

Resolution: wontfix
Status: newclosed

whoops, wrong project :(

comment:2 by Tim Graham, 8 years ago

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