[geany/www.geany.org] 9f2acf: Better use django.conf.timezone.now() instead of datetime.datetime.now()

Enrico Tröger git-noreply at xxxxx
Sun Jan 5 18:48:47 UTC 2014


Branch:      refs/heads/master
Author:      Enrico Tröger <enrico.troeger at uvena.de>
Committer:   Enrico Tröger <enrico.troeger at uvena.de>
Date:        Sun, 15 Dec 2013 18:03:26 UTC
Commit:      9f2acf580c590f90f911568220ae316cfb55fd87
             https://github.com/geany/www.geany.org/commit/9f2acf580c590f90f911568220ae316cfb55fd87

Log Message:
-----------
Better use django.conf.timezone.now() instead of datetime.datetime.now()

django.conf.timezone.now() is timezone aware while the good old datetime is not.


Modified Paths:
--------------
    pastebin/views.py

Modified: pastebin/views.py
4 files changed, 2 insertions(+), 2 deletions(-)
===================================================================
@@ -12,7 +12,6 @@
 # You should have received a copy of the GNU Affero General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-from datetime import datetime
 from django.conf import settings
 from django.contrib.sites.models import Site
 from django.core.exceptions import ObjectDoesNotExist, MultipleObjectsReturned
@@ -21,6 +20,7 @@
     HttpResponse, HttpResponseForbidden
 from django.shortcuts import render_to_response, get_object_or_404
 from django.template.context import RequestContext
+from django.utils import timezone
 from django.views.decorators.csrf import csrf_exempt
 from django.views.decorators.http import require_POST
 from honeypot.decorators import check_honeypot
@@ -47,7 +47,7 @@ def _get_snippet_list(no_content=False):
 
 #----------------------------------------------------------------------
 def _clean_expired_snippets():
-    deleteable_snippets = Snippet.objects.filter(expires__lte=datetime.now())
+    deleteable_snippets = Snippet.objects.filter(expires__lte=timezone.now())
     if deleteable_snippets:
         deleteable_snippets.delete()
 



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Commits mailing list