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

Rename backends from None to none

All other backend names are lower case.
Unrud 8 лет назад
Родитель
Сommit
eba6621f17
4 измененных файлов с 16 добавлено и 16 удалено
  1. 3 3
      config
  2. 1 1
      radicale/auth.py
  3. 2 2
      radicale/rights.py
  4. 10 10
      radicale/tests/test_rights.py

+ 3 - 3
config

@@ -66,8 +66,8 @@
 [auth]
 
 # Authentication method
-# Value: None | htpasswd | remote_user | http_x_remote_user
-#type = None
+# Value: none | htpasswd | remote_user | http_x_remote_user
+#type = none
 
 # Htpasswd filename
 #htpasswd_filename = /etc/radicale/users
@@ -85,7 +85,7 @@
 [rights]
 
 # Rights backend
-# Value: None | authenticated | owner_only | owner_write | from_file
+# Value: none | authenticated | owner_only | owner_write | from_file
 #type = owner_only
 
 # File for rights management from_file

+ 1 - 1
radicale/auth.py

@@ -64,7 +64,7 @@ from importlib import import_module
 def load(configuration, logger):
     """Load the authentication manager chosen in configuration."""
     auth_type = configuration.get("auth", "type")
-    if auth_type == "None":
+    if auth_type in ("None", "none"):  # DEPRECATED: use "none"
         class_ = NoneAuth
     elif auth_type == "remote_user":
         class_ = RemoteUserAuth

+ 2 - 2
radicale/rights.py

@@ -48,9 +48,9 @@ from . import storage
 def load(configuration, logger):
     """Load the rights manager chosen in configuration."""
     rights_type = configuration.get("rights", "type")
-    if configuration.get("auth", "type") == "None":
+    if configuration.get("auth", "type") in ("None", "none"):  # DEPRECATED
         rights_type = "None"
-    if rights_type == "None":
+    if rights_type in ("None", "none"):  # DEPRECATED: use "none"
         rights_class = NoneRights
     elif rights_type == "authenticated":
         rights_class = AuthenticatedRights

+ 10 - 10
radicale/tests/test_rights.py

@@ -102,16 +102,16 @@ class TestBaseAuthRequests(BaseTest):
         self._test_rights("authenticated", "tmp", "/other", "w", 207)
 
     def test_none(self):
-        self._test_rights("None", "", "/", "r", 207)
-        self._test_rights("None", "", "/", "w", 207)
-        self._test_rights("None", "", "/tmp", "r", 207)
-        self._test_rights("None", "", "/tmp", "w", 207)
-        self._test_rights("None", "tmp", "/", "r", 207)
-        self._test_rights("None", "tmp", "/", "w", 207)
-        self._test_rights("None", "tmp", "/tmp", "r", 207)
-        self._test_rights("None", "tmp", "/tmp", "w", 207)
-        self._test_rights("None", "tmp", "/other", "r", 207)
-        self._test_rights("None", "tmp", "/other", "w", 207)
+        self._test_rights("none", "", "/", "r", 207)
+        self._test_rights("none", "", "/", "w", 207)
+        self._test_rights("none", "", "/tmp", "r", 207)
+        self._test_rights("none", "", "/tmp", "w", 207)
+        self._test_rights("none", "tmp", "/", "r", 207)
+        self._test_rights("none", "tmp", "/", "w", 207)
+        self._test_rights("none", "tmp", "/tmp", "r", 207)
+        self._test_rights("none", "tmp", "/tmp", "w", 207)
+        self._test_rights("none", "tmp", "/other", "r", 207)
+        self._test_rights("none", "tmp", "/other", "w", 207)
 
     def test_from_file(self):
         rights_file_path = os.path.join(self.colpath, "rights")