annotate core/tasks.py @ 693:ad69236e8501

For issue #52, update many 3rd party Javascript libraries. Updated to jquery 1.10.2, jquery ui 1.10.3. This broke a lot of stuff. - Found a newer version of the jquery cycle all plugin (3.0.3). - Updated JPlayer to 2.4.0. - Updated to MarkItUp 1.1.14. This also required me to add multiline attributes set to true on various buttons in the markdown set. - As per a stackoverflow post, added some code to get multiline titles in a jQuery UI dialog. They removed that functionality but allow you to put it back. Tweaked the MarkItUp preview CSS to show blockquotes in italic. Did not update TinyMCE at this time. I'm not using the JQuery version and this version appears to work ok for now. What I should do is make a repo for MarkItUp and do a vendor branch thing so I don't have to futz around diffing directories to figure out if I'll lose changes when I update.
author Brian Neal <bgneal@gmail.com>
date Wed, 04 Sep 2013 19:55:20 -0500
parents 53a56d19568c
children aeafbf3ecebf
rev   line source
bgneal@513 1 """
bgneal@513 2 Celery tasks for the core application.
bgneal@513 3
bgneal@513 4 """
bgneal@513 5 from celery.task import task
bgneal@513 6 import django.core.mail
bgneal@513 7
bgneal@519 8 import core.whos_online
bgneal@519 9
bgneal@513 10
bgneal@513 11 @task
bgneal@513 12 def add(x, y):
bgneal@516 13 """
bgneal@516 14 It is useful to have a test task laying around. This is it.
bgneal@516 15
bgneal@516 16 """
bgneal@513 17 return x + y
bgneal@513 18
bgneal@516 19
bgneal@513 20 @task
bgneal@513 21 def send_mail(subject, message, from_email, recipient_list, **kwargs):
bgneal@516 22 """
bgneal@516 23 A task to send mail via Django.
bgneal@516 24
bgneal@516 25 """
bgneal@513 26 django.core.mail.send_mail(subject, message, from_email, recipient_list,
bgneal@513 27 **kwargs)
bgneal@516 28
bgneal@516 29
bgneal@516 30 @task
bgneal@516 31 def cleanup():
bgneal@516 32 """
bgneal@516 33 A task to perform site-wide cleanup actions.
bgneal@516 34
bgneal@516 35 """
bgneal@518 36 # These imports, when placed at the top of the module, caused all kinds of
bgneal@518 37 # import problems when running on the production server (Python 2.5 and
bgneal@518 38 # mod_wsgi). Moving them here worked around that problem.
bgneal@518 39
bgneal@681 40 from django.contrib.sessions.management.commands import clearsessions
bgneal@681 41 from forums.management.commands import forum_cleanup
bgneal@518 42
bgneal@681 43 # Cleanup old sessions
bgneal@516 44
bgneal@681 45 command = clearsessions.Command()
bgneal@516 46 command.execute()
bgneal@516 47
bgneal@516 48 # Execute our forum cleanup command to delete old last visit records.
bgneal@516 49
bgneal@681 50 command = forum_cleanup.Command()
bgneal@516 51 command.execute()
bgneal@519 52
bgneal@519 53
bgneal@519 54 @task
bgneal@519 55 def max_users():
bgneal@519 56 """
bgneal@519 57 Run the periodic task to calculate the who's online max users/visitors
bgneal@519 58 statistics.
bgneal@519 59
bgneal@519 60 """
bgneal@519 61 core.whos_online.max_users()