Django

Code

Show
Ignore:
Timestamp:
06/17/07 17:18:54 (2 years ago)
Author:
clong
Message:

per-object-permissions: Merged to trunk [5486] NOTE: Not fully tested, will be working on this over the next few weeks.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/branches/per-object-permissions/django/bin/daily_cleanup.py

    • Property svn:eol-style set to native
    r3940 r5488  
     1#!/usr/bin/env python 
     2 
    13""" 
    24Daily cleanup job. 
     
    68""" 
    79 
    8 from django.db import backend, connection, transaction 
     10import datetime 
     11from django.db import transaction 
     12from django.contrib.sessions.models import Session 
    913 
    1014def clean_up(): 
    11     # Clean up old database records 
    12     cursor = connection.cursor() 
    13     cursor.execute("DELETE FROM %s WHERE %s < NOW()" % \ 
    14         (backend.quote_name('django_session'), backend.quote_name('expire_date'))) 
     15    """Clean up expired sessions.""" 
     16    Session.objects.filter(expire_date__lt=datetime.datetime.now()).delete() 
    1517    transaction.commit_unless_managed() 
    1618