Localized timezone support (Djblets)
Review Request #2721 — Created Dec. 1, 2011 and submitted
Supports the USE_TZ feature in Django dev by creating UTC, timezone aware datetime objects. DateTimeColumn and DateTimeSinceColumn are updated to accept a new parameter "timezone", which converts the datetime object into that timezone. A TimeZoneField form field is created to make implementing a timezone ChoiceField simple. Lastly, timezones are created as UTC and are checked to be aware/naive for backwards compatibility.
Description | From | Last Updated |
---|---|---|
This isn't a built-in Python module, so make sure setup.py depends on it. |
chipx86 | |
What happens on Django <= 1.3? Does this exist? Today, Djblets must work with Django 1.1 and higher, so you … |
chipx86 | |
Same comments here. |
chipx86 | |
Blank lines before and after this block. |
chipx86 | |
Two blank lines. |
chipx86 | |
"""A form blah blah""" First line should be summary, appended to """. If it can fit on one line, then … |
chipx86 | |
Same question here. |
chipx86 | |
Indent 4 spaces |
mike_conley | |
We'll probably want newlines before and after this block. |
mike_conley | |
We'll want a newline before this block. |
mike_conley |
DD
- Change Summary:
-
Added helper method for creating tz aware, UTC datetimes. Fixed other stuff from reviews.
-
Dave: So I committed the patch to Djblets, and when trying to kick off the devserver, I was getting: Running dependency checks (set DEBUG=False to turn this off)... Traceback (most recent call last): File "./reviewboard/manage.py", line 174, in <module> check_dependencies() File "./reviewboard/manage.py", line 41, in check_dependencies from reviewboard.admin import checks File "/media/Projects/reviewboard/reviewboard/admin/checks.py", line 40, in <module> from djblets.siteconfig.models import SiteConfiguration File "/media/Projects/djblets/djblets/siteconfig/models.py", line 31, in <module> from djblets.util.fields import JSONField File "/media/Projects/djblets/djblets/util/fields.py", line 42, in <module> from djblets.util.dates import get_tz_aware_utcnow ImportError: cannot import name get_tz_aware_utcnow Looking at djblets.util.dates, it looks like there's a function missing. Can you look into this please? Thanks, -Mike
-
If I try to run this using Django 1.3, I get the following: Traceback (most recent call last): File "./reviewboard/manage.py", line 174, in <module> check_dependencies() File "./reviewboard/manage.py", line 41, in check_dependencies from reviewboard.admin import checks File "/home/david/Projects/reviewboard/reviewboard/admin/checks.py", line 40, in <module> from djblets.siteconfig.models import SiteConfiguration File "/usr/local/lib/python2.7/dist-packages/Djblets-0.7alpha0.dev-py2.7.egg/djblets/siteconfig/models.py", line 31, in <module> from djblets.util.fields import JSONField File "/usr/local/lib/python2.7/dist-packages/Djblets-0.7alpha0.dev-py2.7.egg/djblets/util/fields.py", line 36, in <module> from django.utils.timezone import is_aware ImportError: No module named timezone It looks like a previous version of your change caught ImportError to support this. Why did you remove it?