Mercurial > libervia-backend
diff sat_frontends/jp/cmd_encryption.py @ 4037:524856bd7b19
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.
author | Goffi <goffi@goffi.org> |
---|---|
date | Sat, 08 Apr 2023 13:54:42 +0200 |
parents | be6d91572633 |
children | 4b842c1fb686 |
line wrap: on
line diff
--- a/sat_frontends/jp/cmd_encryption.py Fri Apr 07 15:18:39 2023 +0200 +++ b/sat_frontends/jp/cmd_encryption.py Sat Apr 08 13:54:42 2023 +0200 @@ -49,7 +49,7 @@ async def start(self): try: - plugins_ser = await self.host.bridge.encryptionPluginsGet() + plugins_ser = await self.host.bridge.encryption_plugins_get() plugins = data_format.deserialise(plugins_ser, type_check=list) except Exception as e: self.disp(f"can't retrieve plugins: {e}", error=True) @@ -77,7 +77,7 @@ jids = await self.host.check_jids([self.args.jid]) jid = jids[0] try: - serialised = await self.host.bridge.messageEncryptionGet(jid, self.profile) + serialised = await self.host.bridge.message_encryption_get(jid, self.profile) except Exception as e: self.disp(f"can't get session: {e}", error=True) self.host.quit(C.EXIT_BRIDGE_ERRBACK) @@ -117,7 +117,7 @@ async def start(self): if self.args.name is not None: try: - namespace = await self.host.bridge.encryptionNamespaceGet(self.args.name) + namespace = await self.host.bridge.encryption_namespace_get(self.args.name) except Exception as e: self.disp(f"can't get encryption namespace: {e}", error=True) self.host.quit(C.EXIT_BRIDGE_ERRBACK) @@ -130,7 +130,7 @@ jid = jids[0] try: - await self.host.bridge.messageEncryptionStart( + await self.host.bridge.message_encryption_start( jid, namespace, not self.args.encrypt_noreplace, self.profile) except Exception as e: @@ -157,7 +157,7 @@ jids = await self.host.check_jids([self.args.jid]) jid = jids[0] try: - await self.host.bridge.messageEncryptionStop(jid, self.profile) + await self.host.bridge.message_encryption_stop(jid, self.profile) except Exception as e: self.disp(f"can't end encrypted session: {e}", error=True) self.host.quit(C.EXIT_BRIDGE_ERRBACK) @@ -187,7 +187,7 @@ async def start(self): if self.args.name is not None: try: - namespace = await self.host.bridge.encryptionNamespaceGet(self.args.name) + namespace = await self.host.bridge.encryption_namespace_get(self.args.name) except Exception as e: self.disp(f"can't get encryption namespace: {e}", error=True) self.host.quit(C.EXIT_BRIDGE_ERRBACK) @@ -200,7 +200,7 @@ jid = jids[0] try: - xmlui_raw = await self.host.bridge.encryptionTrustUIGet( + xmlui_raw = await self.host.bridge.encryption_trust_ui_get( jid, namespace, self.profile) except Exception as e: self.disp(f"can't get encryption session trust UI: {e}", error=True) @@ -209,7 +209,7 @@ xmlui = xmlui_manager.create(self.host, xmlui_raw) await xmlui.show() if xmlui.type != C.XMLUI_DIALOG: - await xmlui.submitForm() + await xmlui.submit_form() self.host.quit() class EncryptionTrust(base.CommandBase):