##// END OF EJS Templates
logging: remove excesive log that is redundant with following entry.
marcink -
r118:160d7190 default
parent child Browse files
Show More
@@ -1,85 +1,82 b''
1 1 # RhodeCode VCSServer provides access to different vcs backends via network.
2 2 # Copyright (C) 2014-2016 RodeCode GmbH
3 3 #
4 4 # This program is free software; you can redistribute it and/or modify
5 5 # it under the terms of the GNU General Public License as published by
6 6 # the Free Software Foundation; either version 3 of the License, or
7 7 # (at your option) any later version.
8 8 #
9 9 # This program is distributed in the hope that it will be useful,
10 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 12 # GNU General Public License for more details.
13 13 #
14 14 # You should have received a copy of the GNU General Public License
15 15 # along with this program; if not, write to the Free Software Foundation,
16 16 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 17
18 18 import logging
19 19 import urlparse
20 20
21 21 log = logging.getLogger(__name__)
22 22
23 23
24 24 class RepoFactory(object):
25 25 """
26 26 Utility to create instances of repository
27 27
28 28 It provides internal caching of the `repo` object based on
29 29 the :term:`call context`.
30 30 """
31 31
32 32 def __init__(self, repo_cache):
33 33 self._cache = repo_cache
34 34
35 35 def _create_config(self, path, config):
36 36 config = {}
37 37 return config
38 38
39 39 def _create_repo(self, wire, create):
40 40 raise NotImplementedError()
41 41
42 42 def repo(self, wire, create=False):
43 43 """
44 44 Get a repository instance for the given path.
45 45
46 46 Uses internally the low level beaker API since the decorators introduce
47 47 significant overhead.
48 48 """
49 49 def create_new_repo():
50 50 return self._create_repo(wire, create)
51 51
52 52 return self._repo(wire, create_new_repo)
53 53
54 54 def _repo(self, wire, createfunc):
55 55 context = wire.get('context', None)
56 56 cache = wire.get('cache', True)
57 log.debug(
58 'GET %s@%s with cache:%s. Context: %s',
59 self.__class__.__name__, wire['path'], cache, context)
60 57
61 58 if context and cache:
62 59 cache_key = (context, wire['path'])
63 60 log.debug(
64 61 'FETCH %s@%s repo object from cache. Context: %s',
65 62 self.__class__.__name__, wire['path'], context)
66 63 return self._cache.get(key=cache_key, createfunc=createfunc)
67 64 else:
68 65 log.debug(
69 66 'INIT %s@%s repo object based on wire %s. Context: %s',
70 67 self.__class__.__name__, wire['path'], wire, context)
71 68 return createfunc()
72 69
73 70
74 71 def obfuscate_qs(query_string):
75 72 if query_string is None:
76 73 return None
77 74
78 75 parsed = []
79 76 for k, v in urlparse.parse_qsl(query_string, keep_blank_values=True):
80 77 if k in ['auth_token', 'api_key']:
81 78 v = "*****"
82 79 parsed.append((k, v))
83 80
84 81 return '&'.join('{}{}'.format(
85 82 k, '={}'.format(v) if v else '') for k, v in parsed)
General Comments 0
You need to be logged in to leave comments. Login now