Show More
@@ -26,11 +26,12 b' import collections' | |||||
26 | import logging |
|
26 | import logging | |
27 |
|
27 | |||
28 | from rhodecode.api.exc import JSONRPCError |
|
28 | from rhodecode.api.exc import JSONRPCError | |
29 | from rhodecode.lib.auth import HasPermissionAnyApi, HasRepoPermissionAnyApi, \ |
|
29 | from rhodecode.lib.auth import ( | |
30 | HasRepoGroupPermissionAnyApi |
|
30 | HasPermissionAnyApi, HasRepoPermissionAnyApi, HasRepoGroupPermissionAnyApi) | |
31 | from rhodecode.lib.utils import safe_unicode |
|
31 | from rhodecode.lib.utils import safe_unicode | |
|
32 | from rhodecode.lib.vcs.exceptions import RepositoryError | |||
32 | from rhodecode.controllers.utils import get_commit_from_ref_name |
|
33 | from rhodecode.controllers.utils import get_commit_from_ref_name | |
33 |
from rhodecode.lib. |
|
34 | from rhodecode.lib.utils2 import str2bool | |
34 |
|
35 | |||
35 | log = logging.getLogger(__name__) |
|
36 | log = logging.getLogger(__name__) | |
36 |
|
37 | |||
@@ -92,7 +93,7 b' class Optional(object):' | |||||
92 | return self.type_ |
|
93 | return self.type_ | |
93 |
|
94 | |||
94 | @classmethod |
|
95 | @classmethod | |
95 | def extract(cls, val, evaluate_locals=None): |
|
96 | def extract(cls, val, evaluate_locals=None, binary=None): | |
96 | """ |
|
97 | """ | |
97 | Extracts value from Optional() instance |
|
98 | Extracts value from Optional() instance | |
98 |
|
99 | |||
@@ -101,7 +102,11 b' class Optional(object):' | |||||
101 | value of instance |
|
102 | value of instance | |
102 | """ |
|
103 | """ | |
103 | if isinstance(val, cls): |
|
104 | if isinstance(val, cls): | |
104 |
|
|
105 | val = val.getval(evaluate_locals) | |
|
106 | ||||
|
107 | if binary: | |||
|
108 | val = str2bool(val) | |||
|
109 | ||||
105 | return val |
|
110 | return val | |
106 |
|
111 | |||
107 |
|
112 |
General Comments 0
You need to be logged in to leave comments.
Login now