[CalendarServer-changes] [4773] CalendarServer/trunk/twistedcaldav/scheduling

source_changes at macosforge.org source_changes at macosforge.org
Wed Nov 18 12:38:45 PST 2009


Revision: 4773
          http://trac.macosforge.org/projects/calendarserver/changeset/4773
Author:   sagen at apple.com
Date:     2009-11-18 12:38:45 -0800 (Wed, 18 Nov 2009)
Log Message:
-----------
Do an exact comparison on Scheduling.CalDAV.EmailDomain

Modified Paths:
--------------
    CalendarServer/trunk/twistedcaldav/scheduling/caldav.py

Added Paths:
-----------
    CalendarServer/trunk/twistedcaldav/scheduling/test/test_caldav.py

Modified: CalendarServer/trunk/twistedcaldav/scheduling/caldav.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/scheduling/caldav.py	2009-11-18 20:35:33 UTC (rev 4772)
+++ CalendarServer/trunk/twistedcaldav/scheduling/caldav.py	2009-11-18 20:38:45 UTC (rev 4773)
@@ -71,9 +71,10 @@
 
         # Check for local address matches first
         if cuaddr.startswith("mailto:") and config.Scheduling[cls.serviceType()]["EmailDomain"]:
-            splits = cuaddr[7:].split("?")
+            addr = cuaddr[7:].split("?")[0]
             domain = config.Scheduling[cls.serviceType()]["EmailDomain"]
-            if splits[0].endswith(domain):
+            account, addrDomain = addr.split("@")
+            if addrDomain == domain:
                 return True
 
         elif (cuaddr.startswith("http://") or cuaddr.startswith("https://")) and config.Scheduling[cls.serviceType()]["HTTPDomain"]:

Added: CalendarServer/trunk/twistedcaldav/scheduling/test/test_caldav.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/scheduling/test/test_caldav.py	                        (rev 0)
+++ CalendarServer/trunk/twistedcaldav/scheduling/test/test_caldav.py	2009-11-18 20:38:45 UTC (rev 4773)
@@ -0,0 +1,33 @@
+##
+# Copyright (c) 2005-2009 Apple Inc. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+##
+
+import twistedcaldav.test.util
+from twistedcaldav.scheduling.caldav import ScheduleViaCalDAV
+from twistedcaldav.config import config
+
+class CalDAV (twistedcaldav.test.util.TestCase):
+    """
+    twistedcaldav.scheduling.caldav tests
+    """
+
+    def test_matchCalendarUserAddress(self):
+        """
+        Make sure we do an exact comparison on EmailDomain
+        """
+        config.Scheduling[ScheduleViaCalDAV.serviceType()]["EmailDomain"] = "example.com"
+        self.assertTrue(ScheduleViaCalDAV.matchCalendarUserAddress("mailto:user at example.com"))
+        self.assertFalse(ScheduleViaCalDAV.matchCalendarUserAddress("mailto:user at foo.example.com"))
+        self.assertFalse(ScheduleViaCalDAV.matchCalendarUserAddress("mailto:user at xyzexample.com"))
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20091118/d2aa3561/attachment.html>


More information about the calendarserver-changes mailing list