def enableTracCommitHook(self, enable): # only enable when trac env could be found, but always disable (whether trac # env could be found or not) (ticket #194, #269) if options.value('enabled_trac', 'no') == 'no': enable = False if enable: if not trac.exists(self.name): enable = False self.repository.enableTracCommitHook(enable) trigger_hook('repository-notifications-update', repositoryname=self.name, vcs_type=self.vcs_type)
def show(self, req, vcs_type, path, templatevars): import os.path u = user.User(req.session['user']['name']) try: repos = Repository(path[0], vcs_type) # Lie if user has no permission to read if not u.is_admin and not repository.userHasReadPermissions( u.name, path[0], vcs_type): raise DoesNotExistError except DoesNotExistError: return ErrorResponse('This repository does not exist.', request=req) trac_enabled = options.value('enabled_trac', 'no') != 'no' if trac_enabled: templatevars['trac_config_ok'] = True templatevars['trac_exists'] = False try: if trac.exists(path[0]): templatevars['trac_exists'] = True except MissingConfig as e: templatevars['trac_config_ok'] = False templatevars['trac_msg'] = \ 'There is something missing in your config: %s' % str(e) trac_base_url = options.url_path('base_url_trac') trac_http_url = str(trac_base_url + repos.name) templatevars['trac_http_url'] = trac_http_url try: vcs_url = repos.url() except MissingConfig as e: vcs_url = "" templatevars['vcs_url_error'] = str(e) templatevars['vcs_url'] = vcs_url templatevars['repository'] = repos templatevars['vcs_type'] = vcs_type formatted = evaluate_main('repositories.html', templatevars, request=req) return Response(formatted)
def show(self, req, vcs_type, path, templatevars): import os.path u = user.User(req.session['user']['name']) try: repos = Repository(path[0], vcs_type) # Lie if user has no permission to read if not u.is_admin and not repository.userHasReadPermissions(u.name, path[0], vcs_type): raise DoesNotExistError except DoesNotExistError: return ErrorResponse('This repository does not exist.', request=req) trac_enabled = options.value('enabled_trac', 'no') != 'no' if trac_enabled: templatevars['trac_config_ok'] = True templatevars['trac_exists'] = False try: if trac.exists(path[0]): templatevars['trac_exists'] = True except MissingConfig as e: templatevars['trac_config_ok'] = False templatevars['trac_msg'] = \ 'There is something missing in your config: %s' % str(e) trac_base_url = options.url_path('base_url_trac') trac_http_url = str(trac_base_url + repos.name) templatevars['trac_http_url'] = trac_http_url try: vcs_url = repos.url() except MissingConfig as e: vcs_url = "" templatevars['vcs_url_error'] = str(e) templatevars['vcs_url'] = vcs_url templatevars['repository'] = repos templatevars['vcs_type'] = vcs_type formatted = evaluate_main('repositories.html', templatevars, request=req) return Response(formatted)