Mercurial > libervia-backend
comparison sat/plugins/plugin_tmp_directory_subscription.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 | 559a625a236b |
children |
comparison
equal
deleted
inserted
replaced
4036:c4464d7ae97b | 4037:524856bd7b19 |
---|---|
44 | 44 |
45 class DirectorySubscription(object): | 45 class DirectorySubscription(object): |
46 def __init__(self, host): | 46 def __init__(self, host): |
47 log.info(_("Directory subscription plugin initialization")) | 47 log.info(_("Directory subscription plugin initialization")) |
48 self.host = host | 48 self.host = host |
49 host.importMenu( | 49 host.import_menu( |
50 (D_("Service"), D_("Directory subscription")), | 50 (D_("Service"), D_("Directory subscription")), |
51 self.subscribe, | 51 self.subscribe, |
52 security_limit=1, | 52 security_limit=1, |
53 help_string=D_("User directory subscription"), | 53 help_string=D_("User directory subscription"), |
54 ) | 54 ) |
58 | 58 |
59 @param raw_data (dict): data received from the frontend | 59 @param raw_data (dict): data received from the frontend |
60 @param profile (unicode): %(doc_profile)s | 60 @param profile (unicode): %(doc_profile)s |
61 @return: a deferred dict{unicode: unicode} | 61 @return: a deferred dict{unicode: unicode} |
62 """ | 62 """ |
63 d = self.host.plugins["XEP-0055"]._getHostServices(profile) | 63 d = self.host.plugins["XEP-0055"]._get_host_services(profile) |
64 | 64 |
65 def got_services(services): | 65 def got_services(services): |
66 service_jid = services[0] | 66 service_jid = services[0] |
67 session_id, session_data = self.host.plugins[ | 67 session_id, session_data = self.host.plugins[ |
68 "XEP-0050" | 68 "XEP-0050" |
69 ].requesting.newSession(profile=profile) | 69 ].requesting.new_session(profile=profile) |
70 session_data["jid"] = service_jid | 70 session_data["jid"] = service_jid |
71 session_data["node"] = CMD_UPDATE_SUBSCRIBTION | 71 session_data["node"] = CMD_UPDATE_SUBSCRIBTION |
72 data = {"session_id": session_id} | 72 data = {"session_id": session_id} |
73 return self.host.plugins["XEP-0050"]._requestingEntity(data, profile) | 73 return self.host.plugins["XEP-0050"]._requesting_entity(data, profile) |
74 | 74 |
75 return d.addCallback(got_services) | 75 return d.addCallback(got_services) |