Show More
@@ -36,6 +36,35 b' def get_version():' | |||
|
36 | 36 | # link to config for pyramid |
|
37 | 37 | CONFIG = {} |
|
38 | 38 | |
|
39 | ||
|
40 | class ConfigGet: | |
|
41 | NotGiven = object() | |
|
42 | ||
|
43 | def _get_val_or_missing(self, key, missing): | |
|
44 | if key not in CONFIG: | |
|
45 | if missing == self.NotGiven: | |
|
46 | return missing | |
|
47 | # we don't get key, we don't get missing value, return nothing similar as config.get(key) | |
|
48 | return None | |
|
49 | else: | |
|
50 | val = CONFIG[key] | |
|
51 | return val | |
|
52 | ||
|
53 | def get_str(self, key, missing=NotGiven): | |
|
54 | from vcsserver.lib.str_utils import safe_str | |
|
55 | val = self._get_val_or_missing(key, missing) | |
|
56 | return safe_str(val) | |
|
57 | ||
|
58 | def get_int(self, key, missing=NotGiven): | |
|
59 | from vcsserver.lib.str_utils import safe_int | |
|
60 | val = self._get_val_or_missing(key, missing) | |
|
61 | return safe_int(val) | |
|
62 | ||
|
63 | def get_bool(self, key, missing=NotGiven): | |
|
64 | from vcsserver.lib.type_utils import str2bool | |
|
65 | val = self._get_val_or_missing(key, missing) | |
|
66 | return str2bool(val) | |
|
67 | ||
|
39 | 68 | # Populated with the settings dictionary from application init in |
|
40 | 69 | # |
|
41 | 70 | PYRAMID_SETTINGS = {} |
@@ -38,7 +38,7 b' from dulwich.errors import (' | |||
|
38 | 38 | UnexpectedCommandError) |
|
39 | 39 | from dulwich.repo import Repo as DulwichRepo |
|
40 | 40 | |
|
41 | import rhodecode | |
|
41 | import vcsserver | |
|
42 | 42 | from vcsserver import exceptions, settings, subprocessio |
|
43 | 43 | from vcsserver.lib.str_utils import safe_str, safe_int, safe_bytes, ascii_bytes, convert_to_str, splitnewlines |
|
44 | 44 | from vcsserver.base import RepoFactory, obfuscate_qs, ArchiveNode, store_archive_in_cache, BytesEnvelope, BinaryEnvelope |
@@ -1403,7 +1403,7 b' class GitRemote(RemoteBase):' | |||
|
1403 | 1403 | @reraise_safe_exceptions |
|
1404 | 1404 | def run_git_command(self, wire, cmd, **opts): |
|
1405 | 1405 | path = wire.get('path', None) |
|
1406 |
debug_mode = |
|
|
1406 | debug_mode = vcsserver.ConfigGet().get_bool('debug') | |
|
1407 | 1407 | |
|
1408 | 1408 | if path and os.path.isdir(path): |
|
1409 | 1409 | opts['cwd'] = path |
@@ -35,7 +35,7 b' import svn.diff # noqa' | |||
|
35 | 35 | import svn.fs # noqa |
|
36 | 36 | import svn.repos # noqa |
|
37 | 37 | |
|
38 | import rhodecode | |
|
38 | import vcsserver | |
|
39 | 39 | from vcsserver import svn_diff, exceptions, subprocessio, settings |
|
40 | 40 | from vcsserver.base import ( |
|
41 | 41 | RepoFactory, |
@@ -566,7 +566,7 b' class SvnRemote(RemoteBase):' | |||
|
566 | 566 | @reraise_safe_exceptions |
|
567 | 567 | def run_svn_command(self, wire, cmd, **opts): |
|
568 | 568 | path = wire.get('path', None) |
|
569 |
debug_mode = |
|
|
569 | debug_mode = vcsserver.ConfigGet().get_bool('debug') | |
|
570 | 570 | |
|
571 | 571 | if path and os.path.isdir(path): |
|
572 | 572 | opts['cwd'] = path |
General Comments 0
You need to be logged in to leave comments.
Login now