Ticket #4427: daily_cleanup.patch

File daily_cleanup.patch, 542 bytes (added by nick.lane.au@…, 17 years ago)

Patch to use database API for daily_cleanup

Line 
110c10,13
2< from django.db import backend, connection, transaction
3---
4> import datetime
5> from django.db import transaction
6> from django.contrib.sessions.models import Session
7>
813,16c16,17
9< # Clean up old database records
10< cursor = connection.cursor()
11< cursor.execute("DELETE FROM %s WHERE %s < NOW()" % \
12< (backend.quote_name('django_session'), backend.quote_name('expire_date')))
13---
14> # Clean up expired sessions.
15> Session.objects.filter(expire_date__lt=datetime.datetime.now()).delete()
Back to Top