#22625: Installing pytz breaks code already using django's timezone module
---------------------------------+----------------------------
     Reporter:  tom.michaelis@…  |      Owner:  nobody
         Type:  Bug              |     Status:  new
    Component:  Utilities        |    Version:  1.6
     Severity:  Normal           |   Keywords:  pytz, timezone
 Triage Stage:  Unreviewed       |  Has patch:  0
Easy pickings:  0                |      UI/UX:  0
---------------------------------+----------------------------
 pytz is an optional module for Django, used in django.utils.timezone (and
 possibly elsewhere). The documentation recommends that pytz is installed,
 but it's not a requirement.

 The bug is that after installing pytz, methods in django's timezone module
 do not present the same interface as before installation. Installing an
 optional module should not adjust the interface presented.

 The following code works differently before and after installation of
 pytz:

 {{{
 from django.utils import timezone

 now = timezone.now()
 timezone.make_aware(now, timezone.utc())
 }}}

 Before installing pytz, timezone.make_aware essentially does nothing (the
 variable is already timezone aware). After installing pytz,
 timezone.make_aware makes a call to pytz which raises 'ValueError: Not
 naive datetime (tzinfo is already set)', and causes everything to break.

 While I discovered this in django 1.5, I've also been able to replicate
 the bug in django 1.6, so I am filing the bug report under that.

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

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/066.6a7d258f23078e9354b16160b9922753%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to