[Django] #28245: timezone.UTC() is not exported, but is attempted to be accessed

2 views
Skip to first unread message

Django

unread,
May 26, 2017, 8:53:42 PM5/26/17
to django-...@googlegroups.com
#28245: timezone.UTC() is not exported, but is attempted to be accessed
-------------------------------------+-------------------------------------
Reporter: | Owner: nobody
Christopher Dieringer |
Type: Bug | Status: new
Component: | Version: 1.11
Uncategorized |
Severity: Normal | Keywords: utc,fields,timezone
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
== 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
  1130.                         return self.enforce_timezone(parsed)

File "/path/to/rest_framework/fields.py" in enforce_timezone
  1107.             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'

--
Ticket URL: <https://code.djangoproject.com/ticket/28245>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
May 26, 2017, 8:56:00 PM5/26/17
to django-...@googlegroups.com
#28245: timezone.UTC() is not exported, but is attempted to be accessed
-------------------------------------+-------------------------------------
Reporter: Christopher | Owner: nobody
Dieringer |
Type: Bug | Status: closed
Component: Uncategorized | Version: 1.11
Severity: Normal | Resolution: wontfix
Keywords: utc,fields,timezone | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Christopher Dieringer):

* status: new => closed
* resolution: => wontfix


Comment:

whoops, wrong project :(

--
Ticket URL: <https://code.djangoproject.com/ticket/28245#comment:1>

Django

unread,
May 27, 2017, 6:50:37 AM5/27/17
to django-...@googlegroups.com
#28245: timezone.UTC() is not exported, but is attempted to be accessed
-------------------------------------+-------------------------------------
Reporter: Christopher | Owner: nobody
Dieringer |
Type: Bug | Status: closed
Component: Uncategorized | Version: 1.11
Severity: Normal | Resolution: invalid

Keywords: utc,fields,timezone | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham):

* resolution: wontfix => invalid


--
Ticket URL: <https://code.djangoproject.com/ticket/28245#comment:2>

Reply all
Reply to author
Forward
0 new messages