Mercurial > kallithea
changeset 783:71113f64b2d8 beta
fidex corrent variables passed to dnconfig,
fixed celerylib import problem on tests
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Sat, 27 Nov 2010 20:32:34 +0100 |
parents | 51127b2efb33 |
children | 30d3161c6683 |
files | rhodecode/lib/celerylib/__init__.py rhodecode/lib/utils.py |
diffstat | 2 files changed, 63 insertions(+), 25 deletions(-) [+] |
line wrap: on
line diff
--- a/rhodecode/lib/celerylib/__init__.py Sat Nov 27 19:45:10 2010 +0100 +++ b/rhodecode/lib/celerylib/__init__.py Sat Nov 27 20:32:34 2010 +0100 @@ -1,13 +1,42 @@ +# -*- coding: utf-8 -*- +""" + package.rhodecode.lib.celerylib.__init__ + ~~~~~~~~~~~~~~ + + celery libs for RhodeCode + + :created_on: Nov 27, 2010 + :author: marcink + :copyright: (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com> + :license: GPLv3, see COPYING for more details. +""" +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; version 2 +# of the License or (at your opinion) any later version of the license. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301, USA. + import os import sys import socket import traceback import logging -from rhodecode.lib.pidlock import DaemonLock, LockHeld +from hashlib import md5 +from decorator import decorator from vcs.utils.lazy import LazyProperty -from decorator import decorator -from hashlib import md5 + +from rhodecode.lib.pidlock import DaemonLock, LockHeld + from pylons import config log = logging.getLogger(__name__) @@ -15,7 +44,10 @@ def str2bool(v): return v.lower() in ["yes", "true", "t", "1"] if v else None -CELERY_ON = str2bool(config['app_conf'].get('use_celery')) +try: + CELERY_ON = str2bool(config['app_conf'].get('use_celery')) +except KeyError: + CELERY_ON = False class ResultWrapper(object): def __init__(self, task):
--- a/rhodecode/lib/utils.py Sat Nov 27 19:45:10 2010 +0100 +++ b/rhodecode/lib/utils.py Sat Nov 27 20:32:34 2010 +0100 @@ -1,7 +1,15 @@ -#!/usr/bin/env python -# encoding: utf-8 -# Utilities for RhodeCode -# Copyright (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com> +# -*- coding: utf-8 -*- +""" + package.rhodecode.lib.utils + ~~~~~~~~~~~~~~ + + Utilities library for RhodeCode + + :created_on: Apr 18, 2010 + :author: marcink + :copyright: (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com> + :license: GPLv3, see COPYING for more details. +""" # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; version 2 @@ -16,30 +24,28 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, # MA 02110-1301, USA. -""" -Created on April 18, 2010 -Utilities for RhodeCode -@author: marcink -""" + +import os +import logging +import datetime +import traceback +import ConfigParser from UserDict import DictMixin + from mercurial import ui, config, hg from mercurial.error import RepoError + +from paste.script import command +from vcs.backends.base import BaseChangeset +from vcs.utils.lazy import LazyProperty + from rhodecode.model import meta from rhodecode.model.caching_query import FromCache from rhodecode.model.db import Repository, User, RhodeCodeUi, UserLog from rhodecode.model.repo import RepoModel from rhodecode.model.user import UserModel -from vcs.backends.base import BaseChangeset -from paste.script import command -import ConfigParser -from vcs.utils.lazy import LazyProperty -import traceback -import datetime -import logging -import os - log = logging.getLogger(__name__) @@ -464,10 +470,10 @@ log.addHandler(ch) #PART ONE create db - dbname = config['sqlalchemy.db1.url'].split('/')[-1] - log.debug('making test db %s', dbname) + dbconf = config['sqlalchemy.db1.url'] + log.debug('making test db %s', dbconf) - dbmanage = DbManage(log_sql=True, dbname=dbname, root=config['here'], + dbmanage = DbManage(log_sql=True, dbconf=dbconf, root=config['here'], tests=True) dbmanage.create_tables(override=True) dbmanage.config_prompt(repos_test_path)