[CalendarServer-changes] [3670] CalendarServer/trunk

source_changes at macosforge.org source_changes at macosforge.org
Fri Feb 13 12:15:02 PST 2009


Revision: 3670
          http://trac.macosforge.org/projects/calendarserver/changeset/3670
Author:   wsanchez at apple.com
Date:     2009-02-13 12:15:02 -0800 (Fri, 13 Feb 2009)
Log Message:
-----------
Add Aliases config feature.

Modified Paths:
--------------
    CalendarServer/trunk/calendarserver/tap/caldav.py
    CalendarServer/trunk/conf/caldavd-test.plist
    CalendarServer/trunk/conf/caldavd.plist
    CalendarServer/trunk/twistedcaldav/config.py

Modified: CalendarServer/trunk/calendarserver/tap/caldav.py
===================================================================
--- CalendarServer/trunk/calendarserver/tap/caldav.py	2009-02-13 00:32:42 UTC (rev 3669)
+++ CalendarServer/trunk/calendarserver/tap/caldav.py	2009-02-13 20:15:02 UTC (rev 3670)
@@ -47,6 +47,7 @@
 from twisted.web2.auth.basic import BasicCredentialFactory
 from twisted.web2.server import Site
 from twisted.web2.channel import HTTPFactory
+from twisted.web2.static import File as FileResource
 
 from twext.internet.ssl import ChainingOpenSSLContextFactory
 
@@ -483,6 +484,14 @@
         root.putChild("principals", principalCollection)
         root.putChild("calendars", calendarCollection)
 
+        for name, info in config.Aliases.iteritems():
+            if os.path.sep in name or not info.get("path", None):
+                self.log_error("Invalid alias: %s" % (name,))
+                continue
+            self.log_info("Adding alias %s -> %s" % (name, info["path"]))
+            resource = FileResource(info["path"])
+            root.putChild(name, resource)
+
         # Timezone service is optional
         if config.EnableTimezoneService:
             self.log_info("Setting up time zone service resource: %r"

Modified: CalendarServer/trunk/conf/caldavd-test.plist
===================================================================
--- CalendarServer/trunk/conf/caldavd-test.plist	2009-02-13 00:32:42 UTC (rev 3669)
+++ CalendarServer/trunk/conf/caldavd-test.plist	2009-02-13 20:15:02 UTC (rev 3670)
@@ -81,6 +81,16 @@
     <key>DocumentRoot</key>
     <string>twistedcaldav/test/data/</string>
 
+    <!-- Child aliases -->
+    <key>Aliases</key>
+    <dict>
+      <key>webcal</key>
+      <dict>
+        <key>path</key>
+        <string>/usr/share/collaboration</string>
+      </dict>
+    </dict>
+
     <!-- User quota (in bytes) -->
     <key>UserQuota</key>
     <integer>104857600</integer><!-- 100Mb -->

Modified: CalendarServer/trunk/conf/caldavd.plist
===================================================================
--- CalendarServer/trunk/conf/caldavd.plist	2009-02-13 00:32:42 UTC (rev 3669)
+++ CalendarServer/trunk/conf/caldavd.plist	2009-02-13 20:15:02 UTC (rev 3670)
@@ -84,6 +84,16 @@
     <key>DocumentRoot</key>
     <string>/Library/CalendarServer/Documents/</string>
 
+    <!-- Child aliases -->
+    <key>Aliases</key>
+    <dict>
+      <key>webcal</key>
+      <dict>
+        <key>path</key>
+        <string>/usr/share/collaboration</string>
+      </dict>
+    </dict>
+
     <!-- User quota (in bytes) -->
     <key>UserQuota</key>
     <integer>104857600</integer><!-- 100Mb -->

Modified: CalendarServer/trunk/twistedcaldav/config.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/config.py	2009-02-13 00:32:42 UTC (rev 3669)
+++ CalendarServer/trunk/twistedcaldav/config.py	2009-02-13 20:15:02 UTC (rev 3670)
@@ -82,6 +82,8 @@
 }
 
 defaultConfig = {
+    # Note: Don't use None values below; that confuses the command-line parser.
+
     #
     # Public network address information
     #
@@ -96,8 +98,6 @@
     "SSLPort" : 0,        # SSL port (0 to disable HTTPS)
     "RedirectHTTPToHTTPS" : False, # If True, all nonSSL requests redirected to an SSL Port
 
-    # Note: we'd use None above, but that confuses the command-line parser.
-
     #
     # Network address configuration information
     #
@@ -115,6 +115,8 @@
     "UserQuota"            : 104857600, # User quota (in bytes)
     "MaximumAttachmentSize":   1048576, # Attachment size limit (in bytes)
 
+    "Aliases": {},
+
     #
     # Directory service
     #
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20090213/413ecc17/attachment.html>


More information about the calendarserver-changes mailing list