浏览代码

Prevent exception in from_file when user is None

Guillaume DOTT 13 年之前
父节点
当前提交
85a7b7db50
共有 1 个文件被更改,包括 6 次插入2 次删除
  1. 6 2
      radicale/rights/from_file.py

+ 6 - 2
radicale/rights/from_file.py

@@ -68,7 +68,9 @@ else:
 
 def read_authorized(user, collection):
     """Check if the user is allowed to read the collection."""
-    if owner_only.read_authorized(user, collection):
+    if user == None:
+        return False
+    elif owner_only.read_authorized(user, collection):
         return True
     else:
         try:
@@ -78,7 +80,9 @@ def read_authorized(user, collection):
 
 def write_authorized(user, collection):
     """Check if the user is allowed to write the collection."""
-    if owner_only.read_authorized(user, collection):
+    if user == None:
+        return False
+    elif owner_only.read_authorized(user, collection):
         return True
     else:
         try: