comparison twisted/plugins/libervia_server.py @ 1364:df40708c4c76

server: renamed `--dev_mode` to `--dev-mode` and set it as a flag: good practice is to use a dash instead of underscode for CLI arguments. This options is actually a flag, no need to specify the value.
author Goffi <goffi@goffi.org>
date Fri, 20 Nov 2020 17:53:01 +0100
parents c3dac1e11341
children 10517a8698ca
comparison
equal deleted inserted replaced
1363:c3dac1e11341 1364:df40708c4c76
129 ['allow_registration', '', True, _('Allow user to register new ' 129 ['allow_registration', '', True, _('Allow user to register new '
130 'account').encode('utf-8'), coerceBool], 130 'account').encode('utf-8'), coerceBool],
131 ['base_url_ext', '', '', 131 ['base_url_ext', '', '',
132 _('The external URL to use as base URL').encode('utf-8'), 132 _('The external URL to use as base URL').encode('utf-8'),
133 coerceUnicode], 133 coerceUnicode],
134 ['dev_mode', 'D', False, _('Developer mode, automatically reload '
135 'modified pages').encode('utf-8'), coerceBool],
136 ] 134 ]
137 # Options which are in sat.conf only 135 # Options which are in sat.conf only
138 OPT_PARAMETERS_CFG = [ 136 OPT_PARAMETERS_CFG = [
139 ["empty_password_allowed_warning_dangerous_list", None, "", None], 137 ["empty_password_allowed_warning_dangerous_list", None, "", None],
140 ["vhosts_dict", None, {}, None], 138 ["vhosts_dict", None, {}, None],
143 ["menu_extra_json", None, {}, None], 141 ["menu_extra_json", None, {}, None],
144 ["tickets_trackers_json", None, None, None], 142 ["tickets_trackers_json", None, None, None],
145 ["mr_handlers_json", None, None, None], 143 ["mr_handlers_json", None, None, None],
146 ] 144 ]
147 145
146 # Flags are in command line only
147 OPT_FLAGS = [
148 ['dev-mode', 'D', _('Developer mode, automatically reload modified pages')],
149 ]
150
151
148 152
149 def initialise(options): 153 def initialise(options):
150 """Method to initialise global modules""" 154 """Method to initialise global modules"""
151 # XXX: We need to configure logs before any log method is used, 155 # XXX: We need to configure logs before any log method is used,
152 # so here is the best place. 156 # so here is the best place.
164 168
165 169
166 class Options(usage.Options): 170 class Options(usage.Options):
167 # optArgs is not really useful in our case, we need more than a flag 171 # optArgs is not really useful in our case, we need more than a flag
168 optParameters = OPT_PARAMETERS_BOTH 172 optParameters = OPT_PARAMETERS_BOTH
173 optFlags = OPT_FLAGS
169 174
170 def __init__(self): 175 def __init__(self):
171 """Read SàT configuration file in order to overwrite the hard-coded default values 176 """Read SàT configuration file in order to overwrite the hard-coded default values
172 177
173 Priority for the usage of the values is (from lowest to highest): 178 Priority for the usage of the values is (from lowest to highest):