Author: mtredinnick
Date: 2007-06-01 04:46:56 -0500 (Fri, 01 Jun 2007)
New Revision: 5403
Modified:
django/trunk/AUTHORS
django/trunk/django/bin/daily_cleanup.py
Log:
Fixed #4427 -- Ported daily_cleanup.py to use model API for greater
portability. Thanks, [EMAIL PROTECTED]
Modified: django/trunk/AUTHORS
===================================================================
--- django/trunk/AUTHORS 2007-06-01 09:38:32 UTC (rev 5402)
+++ django/trunk/AUTHORS 2007-06-01 09:46:56 UTC (rev 5403)
@@ -142,6 +142,7 @@
Joseph Kocherhans
[EMAIL PROTECTED]
[EMAIL PROTECTED]
+ Nick Lane <[EMAIL PROTECTED]>
Stuart Langridge <http://www.kryogenix.org/>
Nicola Larosa <[EMAIL PROTECTED]>
Eugene Lazutkin <http://lazutkin.com/blog/>
Modified: django/trunk/django/bin/daily_cleanup.py
===================================================================
--- django/trunk/django/bin/daily_cleanup.py 2007-06-01 09:38:32 UTC (rev
5402)
+++ django/trunk/django/bin/daily_cleanup.py 2007-06-01 09:46:56 UTC (rev
5403)
@@ -7,13 +7,13 @@
sessions at the moment).
"""
-from django.db import backend, connection, transaction
+import datetime
+from django.db import transaction
+from django.contrib.sessions.models import Session
def clean_up():
- # Clean up old database records
- cursor = connection.cursor()
- cursor.execute("DELETE FROM %s WHERE %s < NOW()" % \
- (backend.quote_name('django_session'),
backend.quote_name('expire_date')))
+ """Clean up expired sessions."""
+ Session.objects.filter(expire_date__lt=datetime.datetime.now()).delete()
transaction.commit_unless_managed()
if __name__ == "__main__":
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---