[CalendarServer-changes] [2718] CalendarServer/trunk

source_changes at macosforge.org source_changes at macosforge.org
Thu Jul 17 15:30:30 PDT 2008


Revision: 2718
          http://trac.macosforge.org/projects/calendarserver/changeset/2718
Author:   wsanchez at apple.com
Date:     2008-07-17 15:30:29 -0700 (Thu, 17 Jul 2008)
Log Message:
-----------
Make functionality to render a collection as a large calendar optional.

Modified Paths:
--------------
    CalendarServer/trunk/conf/caldavd-test.plist
    CalendarServer/trunk/conf/caldavd.plist
    CalendarServer/trunk/twistedcaldav/config.py
    CalendarServer/trunk/twistedcaldav/resource.py

Modified: CalendarServer/trunk/conf/caldavd-test.plist
===================================================================
--- CalendarServer/trunk/conf/caldavd-test.plist	2008-07-17 22:30:09 UTC (rev 2717)
+++ CalendarServer/trunk/conf/caldavd-test.plist	2008-07-17 22:30:29 UTC (rev 2718)
@@ -201,7 +201,11 @@
   <key>EnableProxyPrincipals</key>
   <true/>
 
+  <!-- Render calendar collections as a monolithic iCalendar object -->
+  <key>EnableMonolithicCalendars</key>
+  <true/>
 
+
   <!--
     Permissions
    -->

Modified: CalendarServer/trunk/conf/caldavd.plist
===================================================================
--- CalendarServer/trunk/conf/caldavd.plist	2008-07-17 22:30:09 UTC (rev 2717)
+++ CalendarServer/trunk/conf/caldavd.plist	2008-07-17 22:30:29 UTC (rev 2718)
@@ -170,7 +170,11 @@
   <key>EnablePrincipalListings</key>
   <true/>
 
+  <!-- Render calendar collections as a monolithic iCalendar object -->
+  <key>EnableMonolithicCalendars</key>
+  <true/>
 
+
   <!--
     Authentication
   -->

Modified: CalendarServer/trunk/twistedcaldav/config.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/config.py	2008-07-17 22:30:09 UTC (rev 2717)
+++ CalendarServer/trunk/twistedcaldav/config.py	2008-07-17 22:30:29 UTC (rev 2718)
@@ -95,9 +95,10 @@
     #
     # Permissions
     #
-    "EnableAnonymousReadRoot": True, # Allow unauthenticated read access to /
-    "EnableAnonymousReadNav": False, # Allow unauthenticated read access to hierachcy
-    "EnablePrincipalListings": True, # Allow listing of principal collections
+    "EnableAnonymousReadRoot": True,    # Allow unauthenticated read access to /
+    "EnableAnonymousReadNav": False,    # Allow unauthenticated read access to hierachcy
+    "EnablePrincipalListings": True,    # Allow listing of principal collections
+    "EnableMonolithicCalendars": True,  # Render calendar collections as a monolithic iCalendar object
 
     #
     # Client controls

Modified: CalendarServer/trunk/twistedcaldav/resource.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/resource.py	2008-07-17 22:30:09 UTC (rev 2717)
+++ CalendarServer/trunk/twistedcaldav/resource.py	2008-07-17 22:30:29 UTC (rev 2718)
@@ -105,17 +105,30 @@
     ##
 
     def render(self, request):
-        # Send listing instead of iCalendar data to HTML agents
-        # This is mostly useful for debugging...
-        # FIXME: Add a self-link to the dirlist with a query string so
-        #     users can still download the actual iCalendar data?
-        agent = request.headers.getHeader("user-agent")
-        if agent is not None and agent.startswith("Mozilla/") and agent.find("Gecko") != -1:
-            html_agent = True
+        if config.EnableMonolithicCalendars:
+            #
+            # Send listing instead of iCalendar data to HTML agents
+            # This is mostly useful for debugging...
+            #
+            # FIXME: Add a self-link to the dirlist with a query string so
+            #     users can still download the actual iCalendar data?
+            #
+            # FIXME: Are there better ways to detect this than hacking in
+            #     user agents?
+            #
+            # FIXME: In the meantime, make this a configurable regex list?
+            #
+            agent = request.headers.getHeader("user-agent")
+            if agent is not None and (
+                agent.startswith("Mozilla/") and agent.find("Gecko") != -1
+            ):
+                renderAsHTML = True
+            else:
+                renderAsHTML = False
         else:
-            html_agent = False
+            renderAsHTML = True
 
-        if not html_agent and self.isPseudoCalendarCollection():
+        if not renderAsHTML and self.isPseudoCalendarCollection():
             # Render a monolithic iCalendar file
             if request.uri[-1] != "/":
                 # Redirect to include trailing '/' in URI
@@ -130,9 +143,9 @@
             d = self.iCalendarRolledup(request)
             d.addCallback(_defer)
             return d
-        else:
-            return super(CalDAVResource, self).render(request)
 
+        return super(CalDAVResource, self).render(request)
+
     def renderHTTP(self, request):
         if config.RejectClients:
             #
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20080717/f67ee2d6/attachment-0001.html 


More information about the calendarserver-changes mailing list