# HG changeset patch # User Marcin Kuzminski # Date 1324428459 -7200 # Node ID 99c70e97ce480b8633dcbf6f69fe1b2fe2114d63 # Parent c60c54e7d211090de9e12a53d2745d9fc8edf466 fixes issue with unbound session, thanks to slafs for patch diff -r c60c54e7d211 -r 99c70e97ce48 rhodecode/lib/celerylib/tasks.py --- a/rhodecode/lib/celerylib/tasks.py Wed Dec 21 02:13:28 2011 +0200 +++ b/rhodecode/lib/celerylib/tasks.py Wed Dec 21 02:47:39 2011 +0200 @@ -55,8 +55,6 @@ add_cache(config) - - __all__ = ['whoosh_index', 'get_commits_stats', 'reset_user_password', 'send_email'] @@ -67,6 +65,7 @@ if CELERY_ON: engine = engine_from_config(config, 'sqlalchemy.db1.') init_model(engine) + sa = meta.Session() return sa @@ -103,7 +102,7 @@ try: lock = l = DaemonLock(file_=jn(lockkey_path, lockkey)) - #for js data compatibilty cleans the key for person from ' + # for js data compatibilty cleans the key for person from ' akc = lambda k: person(k).replace('"', "") co_day_auth_aggr = {} @@ -236,10 +235,10 @@ lock.release() return False - #final release + # final release lock.release() - #execute another task if celery is enabled + # execute another task if celery is enabled if len(repo.revisions) > 1 and CELERY_ON: run_task(get_commits_stats, repo_name, ts_min_y, ts_max_y) return True @@ -342,12 +341,15 @@ log = send_email.get_logger() except: log = logging.getLogger(__name__) - + + sa = get_session() email_config = config if not recipients: # if recipients are not defined we send to email_config + all admins - admins = [u.email for u in User.query().filter(User.admin==True).all()] + admins = [ + u.email for u in sa.query(User).filter(User.admin==True).all() + ] recipients = [email_config.get('email_to')] + admins mail_from = email_config.get('app_email_from')