Author: aaugustin
Date: 2011-11-20 03:04:37 -0800 (Sun, 20 Nov 2011)
New Revision: 17124

Modified:
   django/trunk/django/core/management/commands/cleanup.py
Log:
Upgraded manage.py cleanup to be compatible with time zone support. See also 
r17121.



Modified: django/trunk/django/core/management/commands/cleanup.py
===================================================================
--- django/trunk/django/core/management/commands/cleanup.py     2011-11-20 
10:58:20 UTC (rev 17123)
+++ django/trunk/django/core/management/commands/cleanup.py     2011-11-20 
11:04:37 UTC (rev 17124)
@@ -1,5 +1,5 @@
-import datetime
 from django.core.management.base import NoArgsCommand
+from django.utils import timezone
 
 class Command(NoArgsCommand):
     help = "Can be run as a cronjob or directly to clean out old data from the 
database (only expired sessions at the moment)."
@@ -7,5 +7,5 @@
     def handle_noargs(self, **options):
         from django.db import transaction
         from django.contrib.sessions.models import Session
-        
Session.objects.filter(expire_date__lt=datetime.datetime.now()).delete()
+        Session.objects.filter(expire_date__lt=timezone.now()).delete()
         transaction.commit_unless_managed()

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to