comparison rhodecode/lib/indexers/daemon.py @ 3016:b3c8a3a5ce5f beta

fixed issues some people had with whoosh indexers and unicode decode errors when building os paths
author Marcin Kuzminski <marcin@python-works.com>
date Wed, 21 Nov 2012 23:01:37 +0100
parents 2fa3c09f63e0
children a5f0bc867edc ba08786c49ef
comparison
equal deleted inserted replaced
3015:16af24982e30 3016:b3c8a3a5ce5f
39 project_path = dn(dn(dn(dn(os.path.realpath(__file__))))) 39 project_path = dn(dn(dn(dn(os.path.realpath(__file__)))))
40 sys.path.append(project_path) 40 sys.path.append(project_path)
41 41
42 from rhodecode.config.conf import INDEX_EXTENSIONS 42 from rhodecode.config.conf import INDEX_EXTENSIONS
43 from rhodecode.model.scm import ScmModel 43 from rhodecode.model.scm import ScmModel
44 from rhodecode.lib.utils2 import safe_unicode 44 from rhodecode.lib.utils2 import safe_unicode, safe_str
45 from rhodecode.lib.indexers import SCHEMA, IDX_NAME, CHGSETS_SCHEMA, \ 45 from rhodecode.lib.indexers import SCHEMA, IDX_NAME, CHGSETS_SCHEMA, \
46 CHGSET_IDX_NAME 46 CHGSET_IDX_NAME
47 47
48 from rhodecode.lib.vcs.exceptions import ChangesetError, RepositoryError, \ 48 from rhodecode.lib.vcs.exceptions import ChangesetError, RepositoryError, \
49 NodeDoesNotExistError 49 NodeDoesNotExistError
117 index_paths_ = set() 117 index_paths_ = set()
118 try: 118 try:
119 tip = repo.get_changeset('tip') 119 tip = repo.get_changeset('tip')
120 for _topnode, _dirs, files in tip.walk('/'): 120 for _topnode, _dirs, files in tip.walk('/'):
121 for f in files: 121 for f in files:
122 index_paths_.add(jn(repo.path, f.path)) 122 index_paths_.add(jn(safe_str(repo.path), safe_str(f.path)))
123 123
124 except RepositoryError: 124 except RepositoryError:
125 log.debug(traceback.format_exc()) 125 log.debug(traceback.format_exc())
126 pass 126 pass
127 return index_paths_ 127 return index_paths_