From 4ee9cdc7aff30fc3f45e78292da77b5989bb0e23 Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Fri, 28 Jun 2013 09:35:52 +0100 Subject: [PATCH] Fix compat datetime import when oauth2 provide does not support timezone aware datetimes --- .gitignore | 1 + rest_framework/compat.py | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 2255cd9aa..ae73f8379 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ .* html/ +htmlcov/ coverage/ build/ dist/ diff --git a/rest_framework/compat.py b/rest_framework/compat.py index b748dcc51..cb1228465 100644 --- a/rest_framework/compat.py +++ b/rest_framework/compat.py @@ -494,7 +494,8 @@ try: if provider_version in ('0.2.3', '0.2.4'): # 0.2.3 and 0.2.4 are supported version that do not support # timezone aware datetimes - from datetime.datetime import now as provider_now + import datetime + provider_now = datetime.datetime.now else: # Any other supported version does use timezone aware datetimes from django.utils.timezone import now as provider_now