diff pylons_app/lib/celerylib/tasks.py @ 527:a9e50dce3081 celery

Removed config names from whoosh and celery, celery is now configured based on the config name it's using on celeryconfig. And whoosh uses it's own logger configured just for whoosh Test creates a fresh whoosh index now, for more accurate checks fixed tests for searching
author Marcin Kuzminski <marcin@python-works.com>
date Fri, 17 Sep 2010 22:54:30 +0200
parents a3d9d24acbec
children 5c376ac2d4c9
line wrap: on
line diff
--- a/pylons_app/lib/celerylib/tasks.py	Fri Sep 17 21:35:46 2010 +0200
+++ b/pylons_app/lib/celerylib/tasks.py	Fri Sep 17 22:54:30 2010 +0200
@@ -1,7 +1,7 @@
 from celery.decorators import task
 from celery.task.sets import subtask
+from celeryconfig import PYLONS_CONFIG as config
 from datetime import datetime, timedelta
-from os.path import dirname as dn
 from pylons.i18n.translation import _
 from pylons_app.lib.celerylib import run_task
 from pylons_app.lib.helpers import person
@@ -9,16 +9,9 @@
 from pylons_app.lib.utils import OrderedDict
 from time import mktime
 from vcs.backends.hg import MercurialRepository
-import ConfigParser
 import calendar
-import os
 import traceback
 
-
-root = dn(dn(dn(dn(os.path.realpath(__file__)))))
-config = ConfigParser.ConfigParser({'here':root})
-config.read('%s/development.ini' % root)
-
 __all__ = ['whoosh_index', 'get_commits_stats',
            'reset_user_password', 'send_email']
 
@@ -91,7 +84,7 @@
 def get_commits_stats(repo):
     log = get_commits_stats.get_logger()
     aggregate = OrderedDict()
-    repos_path = get_hg_ui_settings()['paths_root_path'].replace('*','')
+    repos_path = get_hg_ui_settings()['paths_root_path'].replace('*', '')
     repo = MercurialRepository(repos_path + repo)
     #graph range
     td = datetime.today() + timedelta(days=1) 
@@ -205,7 +198,7 @@
     ssl = False
     
     try:
-        m = SmtpMailer(mail_from, user, passwd, mail_server, 
+        m = SmtpMailer(mail_from, user, passwd, mail_server,
                        mail_port, ssl, tls)
         m.send(recipients, subject, body)  
     except: