allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject [7/16] git commit: [#4445] Changed datetime.now() call to datetime.utcnow() and added comment explaining FixedOffset
Date Fri, 21 Sep 2012 20:18:34 GMT
[#4445] Changed datetime.now() call to datetime.utcnow() and added comment explaining FixedOffset

Signed-off-by: Cory Johns <johnsca@geek.net>


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/22635482
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/22635482
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/22635482

Branch: refs/heads/master
Commit: 226354826b98f6200018e22071856b93a7550f81
Parents: 896380a
Author: Cory Johns <johnsca@geek.net>
Authored: Fri Sep 21 14:26:11 2012 +0000
Committer: Dave Brondsema <dbrondsema@geek.net>
Committed: Fri Sep 21 14:55:56 2012 +0000

----------------------------------------------------------------------
 Allura/allura/lib/plugin.py |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/22635482/Allura/allura/lib/plugin.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/plugin.py b/Allura/allura/lib/plugin.py
index 9c46116..f0c923c6 100644
--- a/Allura/allura/lib/plugin.py
+++ b/Allura/allura/lib/plugin.py
@@ -342,7 +342,10 @@ class ProjectRegistrationProvider(object):
         '''
         if security.has_access(neighborhood, 'admin', user=user)():
             return
-        now = datetime.now().replace(tzinfo=FixedOffset(0, 'UTC'))
+        # have to have the replace because, despite being UTC,
+        # the result from utcnow() is still offset-naive  :-(
+        # maybe look into making the mongo connection offset-naive?
+        now = datetime.utcnow().replace(tzinfo=FixedOffset(0, 'UTC'))
         project_count = len(list(user.my_projects()))
         rate_limits = json.loads(config.get('project.rate_limits', '{}'))
         for rate, count in rate_limits.items():


Mime
View raw message