##// END OF EJS Templates
fixed initial whoosh indexer. Build full index on first run even with incremental flag
fixed initial whoosh indexer. Build full index on first run even with incremental flag

File last commit:

r459:7c978511 default
r465:e01a85f9 default
Show More
websetup.py
44 lines | 1.4 KiB | text/x-python | PythonLexer
"""Setup the pylons_app application"""
from os.path import dirname as dn, join as jn
from pylons_app.config.environment import load_environment
from pylons_app.lib.db_manage import DbManage
import datetime
from time import mktime
import logging
import os
import sys
import shutil
log = logging.getLogger(__name__)
ROOT = dn(dn(os.path.realpath(__file__)))
sys.path.append(ROOT)
def setup_app(command, conf, vars):
"""Place any commands to setup pylons_app here"""
log_sql = True
tests = False
dbname = os.path.split(conf['sqlalchemy.db1.url'])[-1]
filename = os.path.split(conf.filename)[-1]
if filename == 'tests.ini':
uniq_suffix = str(int(mktime(datetime.datetime.now().timetuple())))
REPO_TEST_PATH = '/tmp/hg_app_test_%s' % uniq_suffix
if not os.path.isdir(REPO_TEST_PATH):
os.mkdir(REPO_TEST_PATH)
from_ = '/home/marcink/workspace-python/vcs'
shutil.copytree(from_, os.path.join(REPO_TEST_PATH,'vcs_test'))
tests = True
dbmanage = DbManage(log_sql, dbname, tests)
dbmanage.create_tables(override=True)
dbmanage.config_prompt(REPO_TEST_PATH)
dbmanage.create_default_user()
dbmanage.admin_prompt()
dbmanage.create_permissions()
dbmanage.populate_default_permissions()
load_environment(conf.global_conf, conf.local_conf, initial=True)