massive refactoring to switch from camelCase to snake_case:
historically, Libervia (SàT before) was using camelCase as allowed by PEP8 when using a pre-PEP8 code, to use the same coding style as in Twisted. However, snake_case is more readable and it's better to follow PEP8 best practices, so it has been decided to move on full snake_case. Because Libervia has a huge codebase, this ended with a ugly mix of camelCase and snake_case. To fix that, this patch does a big refactoring by renaming every function and method (including bridge) that are not coming from Twisted or Wokkel, to use fully snake_case. This is a massive change, and may result in some bugs.
This commit is contained in:
parent
d50412c7f7
commit
6a6f15707a
1 changed files with 9945 additions and 9945 deletions
|
|
@ -33,14 +33,14 @@ except ImportError:
|
|||
log = getLogger(__name__)
|
||||
|
||||
|
||||
def getOptionsFromConfig(config, section=""):
|
||||
def get_options_from_config(config, section=""):
|
||||
options = {}
|
||||
for option in ('tls_certificate', 'tls_private_key', 'tls_chain'):
|
||||
options[option] = tools_config.getConfig(config, section, option)
|
||||
options[option] = tools_config.config_get(config, section, option)
|
||||
return options
|
||||
|
||||
|
||||
def TLSOptionsCheck(options):
|
||||
def tls_options_check(options):
|
||||
"""Check options coherence if TLS is activated, and update missing values
|
||||
|
||||
Must be called only if TLS is activated
|
||||
|
|
@ -52,7 +52,7 @@ def TLSOptionsCheck(options):
|
|||
options["tls_private_key"] = options["tls_certificate"]
|
||||
|
||||
|
||||
def loadCertificates(f):
|
||||
def load_certificates(f):
|
||||
"""Read a .pem file with a list of certificates
|
||||
|
||||
@param f (file): file obj (opened .pem file)
|
||||
|
|
@ -78,7 +78,7 @@ def loadCertificates(f):
|
|||
return certificates
|
||||
|
||||
|
||||
def loadPKey(f):
|
||||
def load_p_key(f):
|
||||
"""Read a private key from a .pem file
|
||||
|
||||
@param f (file): file obj (opened .pem file)
|
||||
|
|
@ -88,7 +88,7 @@ def loadPKey(f):
|
|||
return OpenSSL.crypto.load_privatekey(OpenSSL.crypto.FILETYPE_PEM, f.read())
|
||||
|
||||
|
||||
def loadCertificate(f):
|
||||
def load_certificate(f):
|
||||
"""Read a public certificate from a .pem file
|
||||
|
||||
@param f (file): file obj (opened .pem file)
|
||||
|
|
@ -98,7 +98,7 @@ def loadCertificate(f):
|
|||
return OpenSSL.crypto.load_certificate(OpenSSL.crypto.FILETYPE_PEM, f.read())
|
||||
|
||||
|
||||
def getTLSContextFactory(options):
|
||||
def get_tls_context_factory(options):
|
||||
"""Load TLS certificate and build the context factory needed for listenSSL"""
|
||||
if ssl is None:
|
||||
raise ImportError("Python module pyOpenSSL is not installed!")
|
||||
|
|
@ -106,9 +106,9 @@ def getTLSContextFactory(options):
|
|||
cert_options = {}
|
||||
|
||||
for name, option, method in [
|
||||
("privateKey", "tls_private_key", loadPKey),
|
||||
("certificate", "tls_certificate", loadCertificate),
|
||||
("extraCertChain", "tls_chain", loadCertificates),
|
||||
("privateKey", "tls_private_key", load_p_key),
|
||||
("certificate", "tls_certificate", load_certificate),
|
||||
("extraCertChain", "tls_chain", load_certificates),
|
||||
]:
|
||||
path = options[option]
|
||||
if not path:
|
||||
|
|
|
|||
Loading…
Reference in a new issue