Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

management/commands: Refactor logging code in register_server.

Eeshan Gargbd197886fe96
diff --git a/zerver/management/commands/register_server.py b/zerver/management/commands/register_server.py
index 957bae46656..168a434e693 100644
--- a/zerver/management/commands/register_server.py
+++ b/zerver/management/commands/register_server.py
@@ -1,6 +1,6 @@
import subprocess
from argparse import ArgumentParser
-from typing import Any
+from typing import Any, Dict
import requests
from django.conf import settings
@@ -63,10 +63,7 @@ class Command(ZulipBaseCommand):
if options["rotate_key"]:
request["new_org_key"] = get_random_string(64)
- print("The following data will be submitted to the push notification service:")
- for key in sorted(request.keys()):
- print(f" {key}: {request[key]}")
- print("")
+ self._log_params(request)
if not options["agree_to_terms_of_service"] and not options["rotate_key"]:
print(
@@ -120,3 +117,9 @@ class Command(ZulipBaseCommand):
]
)
print("Mobile Push Notification Service registration successfully updated!")
+
+ def _log_params(self, params: Dict[str, Any]) -> None:
+ print("The following data will be submitted to the push notification service:")
+ for key in sorted(params.keys()):
+ print(f" {key}: {params[key]}")
+ print("")