Changeset - 03676d39dd0a
[Not reviewed]
default
0 4 0
Marcin Kuzminski - 15 years ago 2010-10-06 18:26:59
marcin@python-works.com
added fault tolerant case when celeryconfig is not present in the directory.
small form fixes,
and websetup default app title and admin name
4 files changed with 15 insertions and 26 deletions:
0 comments (0 inline, 0 general)
rhodecode/lib/celerylib/tasks.py
Show inline comments
 
from celery.decorators import task
 
from celery.task.sets import subtask
 
from celeryconfig import PYLONS_CONFIG as config
 

	
 
from operator import itemgetter
 
from pylons.i18n.translation import _
 
from rhodecode.lib.celerylib import run_task, locked_task
 
@@ -12,6 +11,14 @@ from vcs.backends.hg import MercurialRep
 
import json
 
import traceback
 

	
 
try:
 
    from celeryconfig import PYLONS_CONFIG as config
 
except ImportError:
 
    #if celeryconfig is not present let's just load our pylons
 
    #config instead
 
    from pylons import config
 

	
 

	
 
__all__ = ['whoosh_index', 'get_commits_stats',
 
           'reset_user_password', 'send_email']
 

	
rhodecode/lib/db_manage.py
Show inline comments
 
@@ -150,11 +150,11 @@ class DbManage(object):
 
        hgsettings1 = RhodeCodeSettings()
 
        
 
        hgsettings1.app_settings_name = 'realm'
 
        hgsettings1.app_settings_value = 'rhodecode authentication'
 
        hgsettings1.app_settings_value = 'RhodeCode authentication'
 
        
 
        hgsettings2 = RhodeCodeSettings()
 
        hgsettings2.app_settings_name = 'title'
 
        hgsettings2.app_settings_value = 'rhodecode'      
 
        hgsettings2.app_settings_value = 'RhodeCode'      
 
        
 
        try:
 
            self.sa.add(hooks1)
 
@@ -177,7 +177,7 @@ class DbManage(object):
 
        new_user = User()
 
        new_user.username = username
 
        new_user.password = get_crypt_password(password)
 
        new_user.name = 'Hg'
 
        new_user.name = 'RhodeCode'
 
        new_user.lastname = 'Admin'
 
        new_user.email = email
 
        new_user.admin = admin
rhodecode/model/forms.py
Show inline comments
 
@@ -260,7 +260,7 @@ class LoginForm(formencode.Schema):
 
                            not_empty=True,
 
                            messages={
 
                                      'empty':_('Please enter a password'),
 
                                      'tooShort':_('Enter a value %(min)i characters long or more')}
 
                                      'tooShort':_('Enter %(min)i characters or more')}
 
                                )
 

	
 

	
rhodecode/websetup.py
Show inline comments
 
"""Setup the rhodecode application"""
 
from os.path import dirname as dn, join as jn
 
from rhodecode.config.environment import load_environment
 
from rhodecode.lib.db_manage import DbManage
 
import logging
 
import os
 
import shutil
 

	
 
log = logging.getLogger(__name__)
 
ROOT = dn(os.path.realpath(__file__))
 

	
 
def setup_app(command, conf, vars):
 
    """Place any commands to setup rhodecode here"""
 
    print dn(os.path.realpath(__file__))
 
    print(ROOT)
 
    dbname = os.path.split(conf['sqlalchemy.db1.url'])[-1] 
 
    dbmanage = DbManage(log_sql=True, dbname=dbname, root=conf['here'],
 
                         tests=False)
 
@@ -22,21 +17,8 @@ def setup_app(command, conf, vars):
 
    dbmanage.admin_prompt()
 
    dbmanage.create_permissions()
 
    dbmanage.populate_default_permissions()
 
    
 
    celeryconfig_file = 'celeryconfig.py'
 
    
 
    celeryconfig_path = jn(ROOT, celeryconfig_file)
 
    
 
        
 
    if not os.path.isfile(jn(conf['here'], celeryconfig_file)):
 
        try:
 
            shutil.copy(celeryconfig_path, conf['here'])
 
        except IOError:
 
            log.error('failed to copy celeryconfig.py from source %s ' 
 
                      ' to this directory please copy it manually ',
 
                      celeryconfig_path)
 
        else:       
 
            load_environment(conf.global_conf, conf.local_conf, initial=True)
 
           
 
    load_environment(conf.global_conf, conf.local_conf, initial=True)
 

	
 

	
 

	
0 comments (0 inline, 0 general)