Просмотр исходного кода

Change default value for external users

Unrud 6 лет назад
Родитель
Сommit
caf5ff1080

+ 1 - 2
radicale/__main__.py

@@ -110,8 +110,7 @@ def run():
             os.environ.get("RADICALE_CONFIG"),
             args.config))
         if arguments_config:
-            configuration.update(
-                arguments_config, "arguments", internal=False)
+            configuration.update(arguments_config, "arguments")
     except Exception as e:
         logger.fatal("Invalid configuration: %s", e, exc_info=True)
         exit(1)

+ 3 - 3
radicale/config.py

@@ -274,7 +274,7 @@ def load(paths=()):
         except Exception as e:
             raise RuntimeError(
                 "Failed to load %s: %s" % (config_source, e)) from e
-        configuration.update(config, config_source, internal=False)
+        configuration.update(config, config_source)
     return configuration
 
 
@@ -298,9 +298,9 @@ class Configuration:
                 if option.startswith("_"):
                     continue
                 values[section][option] = schema[section][option]["value"]
-        self.update(values, "default config")
+        self.update(values, "default config", internal=True)
 
-    def update(self, config, source, internal=True):
+    def update(self, config, source, internal=False):
         """Update the configuration.
 
         ``config`` a dict of the format {SECTION: {OPTION: VALUE, ...}, ...}.

+ 2 - 1
radicale/server.py

@@ -247,7 +247,8 @@ def serve(configuration, shutdown_socket=None):
     logger.info("Starting Radicale")
     # Copy configuration before modifying
     configuration = configuration.copy()
-    configuration.update({"internal": {"internal_server": "True"}}, "server")
+    configuration.update({"internal": {"internal_server": "True"}}, "server",
+                         internal=True)
 
     # Create collection servers
     servers = {}

+ 1 - 1
radicale/tests/test_auth.py

@@ -47,7 +47,7 @@ class TestBaseAuthRequests(BaseTest):
             # Disable syncing to disk for better performance
             "internal": {"filesystem_fsync": "False"},
             # Set incorrect authentication delay to a very low value
-            "auth": {"delay": "0.002"}}, "test")
+            "auth": {"delay": "0.002"}}, "test", internal=True)
 
     def teardown(self):
         shutil.rmtree(self.colpath)

+ 2 - 2
radicale/tests/test_base.py

@@ -1476,7 +1476,7 @@ permissions: RrWw""")
             # Disable syncing to disk for better performance
             "internal": {"filesystem_fsync": "False"},
             "rights": {"file": rights_file_path,
-                       "type": "from_file"}}, "test")
+                       "type": "from_file"}}, "test", internal=True)
         self.application = Application(self.configuration)
 
     def teardown(self):
@@ -1490,7 +1490,7 @@ class TestMultiFileSystem(BaseFileSystemTest, BaseRequestsMixIn):
     def test_fsync(self):
         """Create a directory and file with syncing enabled."""
         self.configuration.update({
-            "internal": {"filesystem_fsync": "True"}}, "test")
+            "internal": {"filesystem_fsync": "True"}}, "test", internal=True)
         self.application = Application(self.configuration)
         status, _, _ = self.request("MKCALENDAR", "/calendar.ics/")
         assert status == 201

+ 4 - 3
radicale/tests/test_config.py

@@ -134,10 +134,11 @@ class TestConfig:
 
     def test_internal(self):
         configuration = config.load()
-        configuration.update({"internal": {"internal_server": "True"}}, "test")
+        configuration.update({"internal": {"internal_server": "True"}}, "test",
+                             internal=True)
         with pytest.raises(Exception) as exc_info:
-            configuration.update({"internal": {"internal_server": "True"}},
-                                 "test", internal=False)
+            configuration.update(
+                {"internal": {"internal_server": "True"}}, "test")
         e = exc_info.value
         assert "Invalid section 'internal'" in str(e)
 

+ 1 - 1
radicale/tests/test_rights.py

@@ -38,7 +38,7 @@ class TestBaseRightsRequests(BaseTest):
         self.configuration.update({
             "storage": {"filesystem_folder": self.colpath},
             # Disable syncing to disk for better performance
-            "internal": {"filesystem_fsync": "False"}}, "test")
+            "internal": {"filesystem_fsync": "False"}}, "test", internal=True)
 
     def teardown(self):
         shutil.rmtree(self.colpath)

+ 1 - 1
radicale/tests/test_server.py

@@ -68,7 +68,7 @@ class TestBaseServerRequests:
             # Enable debugging for new processes
             "logging": {"level": "debug"},
             # Disable syncing to disk for better performance
-            "internal": {"filesystem_fsync": "False"}}, "test")
+            "internal": {"filesystem_fsync": "False"}}, "test", internal=True)
         self.thread = threading.Thread(target=server.serve, args=(
             self.configuration, shutdown_socket_out))
         ssl_context = ssl.create_default_context()

+ 1 - 1
radicale/tests/test_web.py

@@ -36,7 +36,7 @@ class TestBaseWebRequests(BaseTest):
         self.configuration.update({
             "storage": {"filesystem_folder": self.colpath},
             # Disable syncing to disk for better performance
-            "internal": {"filesystem_fsync": "False"}}, "test")
+            "internal": {"filesystem_fsync": "False"}}, "test", internal=True)
         self.application = Application(self.configuration)
 
     def teardown(self):