[CalendarServer-changes] [2803] CalendarServer/branches/users/sagen/xmpp-2764

source_changes at macosforge.org source_changes at macosforge.org
Mon Aug 11 15:39:00 PDT 2008


Revision: 2803
          http://trac.macosforge.org/projects/calendarserver/changeset/2803
Author:   sagen at apple.com
Date:     2008-08-11 15:38:59 -0700 (Mon, 11 Aug 2008)
Log Message:
-----------
Use fnmatch instead of re for easier pattern definitions

Modified Paths:
--------------
    CalendarServer/branches/users/sagen/xmpp-2764/conf/caldavd-test.plist
    CalendarServer/branches/users/sagen/xmpp-2764/twistedcaldav/notify.py

Modified: CalendarServer/branches/users/sagen/xmpp-2764/conf/caldavd-test.plist
===================================================================
--- CalendarServer/branches/users/sagen/xmpp-2764/conf/caldavd-test.plist	2008-08-11 21:40:19 UTC (rev 2802)
+++ CalendarServer/branches/users/sagen/xmpp-2764/conf/caldavd-test.plist	2008-08-11 22:38:59 UTC (rev 2803)
@@ -460,10 +460,10 @@
         <key>KeepAliveSeconds</key>
         <integer>120</integer>
 
-        <!-- List of regular expressions defining which XMPP JIDs can converse with the server -->
+        <!-- List of glob-like expressions defining which XMPP JIDs can converse with the server -->
         <key>AllowedJIDs</key>
         <array>
-        <string>.*.apple.com</string>
+          <string>*.apple.com</string>
         </array>
       </dict>
     </array>

Modified: CalendarServer/branches/users/sagen/xmpp-2764/twistedcaldav/notify.py
===================================================================
--- CalendarServer/branches/users/sagen/xmpp-2764/twistedcaldav/notify.py	2008-08-11 21:40:19 UTC (rev 2802)
+++ CalendarServer/branches/users/sagen/xmpp-2764/twistedcaldav/notify.py	2008-08-11 22:38:59 UTC (rev 2803)
@@ -49,7 +49,7 @@
 from twistedcaldav.log import LoggingMixIn
 from twistedcaldav.config import config, parseConfig, defaultConfig
 from zope.interface import Interface, implements
-import re
+from fnmatch import fnmatch
 
 __all__ = [
     "Coalescer",
@@ -642,11 +642,8 @@
 
     def allowedInRoster(self, jid):
         for pattern in self.settings.get("AllowedJIDs", []):
-            try:
-                if re.match(pattern, jid) is not None:
-                    return True
-            except re.error:
-                self.log_error("Invalid regular expression for XMPP notification configuration: %s" % (pattern,))
+            if fnmatch(jid, pattern):
+                return True
         return False
 
     def handleRoster(self, iq):
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20080811/41033fbc/attachment-0001.html 


More information about the calendarserver-changes mailing list