Raise ImportError if python-ctags is missing
Jonas Haag
6 years ago
9 | 9 | |
10 | 10 | try: |
11 | 11 | import ctags |
12 | from klaus import ctagscache | |
13 | 12 | except ImportError: |
14 | 13 | ctags = None |
14 | else: | |
15 | from klaus import ctagscache | |
16 | CTAGS_CACHE = ctagscache.CTagsCache() | |
15 | 17 | |
16 | 18 | from klaus import markup, tarutils |
17 | 19 | from klaus.highlighting import pygmentize |
18 | 20 | from klaus.utils import parent_directory, subpaths, force_unicode, guess_is_binary, \ |
19 | 21 | guess_is_image, replace_dupes |
20 | ||
21 | ||
22 | if ctags: | |
23 | CTAGS_CACHE = ctagscache.CTagsCache() | |
24 | 22 | |
25 | 23 | |
26 | 24 | def repo_list(): |
189 | 187 | should_use_ctags = current_app.should_use_ctags(self.context['repo'], |
190 | 188 | self.context['commit']) |
191 | 189 | if should_use_ctags: |
190 | if ctags is None: | |
191 | raise ImportError("Ctags enabled but python-ctags not installed") | |
192 | 192 | ctags_base_url = url_for( |
193 | 193 | self.view_name, |
194 | 194 | repo=self.context['repo'].name, |