# HG changeset patch # User Goffi # Date 1456745878 -3600 # Node ID a05f3b24f2ec843d96ff53c4ccd6b109dd85bcdd # Parent fa7703642c0eebb7b753f9123fab7d20a0cf45b4 server: use C.bool for bool options instead of simple int diff -r fa7703642c0e -r a05f3b24f2ec src/twisted/plugins/libervia_server.py --- a/src/twisted/plugins/libervia_server.py Mon Feb 29 12:37:45 2016 +0100 +++ b/src/twisted/plugins/libervia_server.py Mon Feb 29 12:37:58 2016 +0100 @@ -93,6 +93,9 @@ raise ValueError("%s is not a Libervia's server data directory" % os.path.realpath(themes_dir)) return value +def coerceBool(value): + return C.bool(value) + DATA_DIR_DEFAULT = '' OPT_PARAMETERS_BOTH = [['connection_type', 't', 'https', _(u"'http', 'https' or 'both' (to launch both servers).").encode('utf-8'), coerceConnectionType], ['port', 'p', 8080, _(u'The port number to listen HTTP on.').encode('utf-8'), int], @@ -101,8 +104,8 @@ ['tls_private_key', '', '', _(u'TLS certificate private key (PEM format)').encode('utf-8'), str], ['tls_certificate', 'c', 'libervia.pem', _(u'TLS public certificate or private key and public certificate combined (PEM format)').encode('utf-8'), str], ['tls_chain', '', '', _(u'TLS certificate intermediate chain (PEM format)').encode('utf-8'), str], - ['redirect_to_https', 'r', 1, _(u'Automatically redirect from HTTP to HTTPS.').encode('utf-8'), int], - ['security_warning', 'w', 1, _(u'Warn user that he is about to connect on HTTP.').encode('utf-8'), int], + ['redirect_to_https', 'r', True, _(u'Automatically redirect from HTTP to HTTPS.').encode('utf-8'), coerceBool], + ['security_warning', 'w', True, _(u'Warn user that he is about to connect on HTTP.').encode('utf-8'), coerceBool], ['passphrase', 'k', '', (_(u"Passphrase for the SàT profile named '%s'") % C.SERVICE_PROFILE).encode('utf-8'), str], ['data_dir', 'd', DATA_DIR_DEFAULT, _(u'Data directory for Libervia').encode('utf-8'), coerceDataDir], ] # options which are in sat.conf and on command line, see https://twistedmatrix.com/documents/current/api/twisted.python.usage.Options.html