Mercurial > kallithea
comparison rhodecode/lib/utils.py @ 1401:b7563ad4e7ee beta
Unicode fixes, added safe_str method for global str() operations +better test sandboxing
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Thu, 30 Jun 2011 01:25:37 +0200 |
parents | dc960653f8d2 |
children | a773087f5e42 |
comparison
equal
deleted
inserted
replaced
1400:0d7b56b97953 | 1401:b7563ad4e7ee |
---|---|
456 | 456 |
457 | 457 |
458 #============================================================================== | 458 #============================================================================== |
459 # TEST FUNCTIONS AND CREATORS | 459 # TEST FUNCTIONS AND CREATORS |
460 #============================================================================== | 460 #============================================================================== |
461 def create_test_index(repo_location, full_index): | 461 def create_test_index(repo_location, config, full_index): |
462 """Makes default test index | 462 """ |
463 :param repo_location: | 463 Makes default test index |
464 | |
465 :param config: test config | |
464 :param full_index: | 466 :param full_index: |
465 """ | 467 """ |
468 | |
466 from rhodecode.lib.indexers.daemon import WhooshIndexingDaemon | 469 from rhodecode.lib.indexers.daemon import WhooshIndexingDaemon |
467 from rhodecode.lib.pidlock import DaemonLock, LockHeld | 470 from rhodecode.lib.pidlock import DaemonLock, LockHeld |
468 import shutil | 471 |
469 | 472 repo_location = repo_location |
470 index_location = os.path.join(repo_location, 'index') | 473 |
471 if os.path.exists(index_location): | 474 index_location = os.path.join(config['app_conf']['index_dir'], 'index') |
472 shutil.rmtree(index_location) | 475 if not os.path.exists(index_location): |
476 os.makedirs(index_location) | |
473 | 477 |
474 try: | 478 try: |
475 l = DaemonLock(file=jn(dn(index_location), 'make_index.lock')) | 479 l = DaemonLock(file=jn(dn(index_location), 'make_index.lock')) |
476 WhooshIndexingDaemon(index_location=index_location, | 480 WhooshIndexingDaemon(index_location=index_location, |
477 repo_location=repo_location)\ | 481 repo_location=repo_location)\ |