[CalendarServer-changes] [829] CalendarServer/trunk/twistedcaldav/resource.py

source_changes at macosforge.org source_changes at macosforge.org
Thu Dec 14 17:04:48 PST 2006


Revision: 829
          http://trac.macosforge.org/projects/calendarserver/changeset/829
Author:   wsanchez at apple.com
Date:     2006-12-14 17:04:48 -0800 (Thu, 14 Dec 2006)

Log Message:
-----------
Send dirlist if HTML agent

Modified Paths:
--------------
    CalendarServer/trunk/twistedcaldav/resource.py

Modified: CalendarServer/trunk/twistedcaldav/resource.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/resource.py	2006-12-15 00:01:31 UTC (rev 828)
+++ CalendarServer/trunk/twistedcaldav/resource.py	2006-12-15 01:04:48 UTC (rev 829)
@@ -83,7 +83,17 @@
     ##
 
     def render(self, request):
-        if self.isPseudoCalendarCollection():
+        # 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.startswith("Mozilla/") and agent.find("Gecko") != -1:
+            html_agent = True
+        else:
+            html_agent = False
+
+        if not html_agent and self.isPseudoCalendarCollection():
             # Render a monolithic iCalendar file
             if request.uri[-1] != "/":
                 # Redirect to include trailing '/' in URI

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20061214/506503e8/attachment.html


More information about the calendarserver-changes mailing list