def execute(self): # TODO: Remove the old way when Django 1.0 lands try: # old way of doing cleanup (pre r7844 in svn) from django.bin.daily_cleanup import clean_up clean_up() except: # new way using the management.call_command function from django.core import management management.call_command("cleanup")
def execute(self): from django.bin.daily_cleanup import clean_up clean_up()
import os from curia import settings from datetime import datetime os.environ['DJANGO_SETTINGS_MODULE'] = 'curia.settings' from django.utils.translation import ugettext as _ # clean up session data from django.bin.daily_cleanup import clean_up clean_up() # mail user notifications from curia.mail import send_html_mail_with_attachments from django.template import loader, Context from django.contrib.sites.models import Site from curia.notifications import get_users_to_email from curia.notifications.models import Notification, SubscriptionResult users = get_users_to_email() #from django.contrib.auth.models import User #users = [User.objects.get(pk=1)] import codecs log = codecs.open('curia_schedule.log', 'w', 'utf-8') for user in users: if user.email != '': new_stuff = {} for community in user.groups.exclude(name='everyone'): notifications = Notification.objects.filter(user=user, originator_group=community) from curia.notifications import get_subscription_entries subscription_entries = get_subscription_entries(user, community)