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

source_changes at macosforge.org source_changes at macosforge.org
Mon Jul 28 14:52:01 PDT 2008


Revision: 2761
          http://trac.macosforge.org/projects/calendarserver/changeset/2761
Author:   wsanchez at apple.com
Date:     2008-07-28 14:52:01 -0700 (Mon, 28 Jul 2008)
Log Message:
-----------
Only wrap try/except around the code you expect to raise.
Fix another assert without explanation.

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

Modified: CalendarServer/trunk/twistedcaldav/resource.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/resource.py	2008-07-28 21:08:00 UTC (rev 2760)
+++ CalendarServer/trunk/twistedcaldav/resource.py	2008-07-28 21:52:01 UTC (rev 2761)
@@ -237,7 +237,9 @@
         return super(CalDAVResource, self).readProperty(property, request)
 
     def writeProperty(self, property, request):
-        assert isinstance(property, davxml.WebDAVElement)
+        assert isinstance(property, davxml.WebDAVElement), (
+            "%r is not a WebDAVElement instance" % (property,)
+        )
 
         if property.qname() == (caldav_namespace, "supported-calendar-component-set"):
             if not self.isPseudoCalendarCollection():
@@ -372,12 +374,12 @@
 
         try:
             resourcetype = self.readDeadProperty((dav_namespace, "resourcetype"))
-            return bool(resourcetype.childrenOfType(collectiontype))
         except HTTPError, e:
             assert e.response.code == responsecode.NOT_FOUND, (
                 "Unexpected response code: %s" % (e.response.code,)
             )
             return False
+        return bool(resourcetype.childrenOfType(collectiontype))
 
     def isPseudoCalendarCollection(self):
         """
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20080728/b6e7f495/attachment.html 


More information about the calendarserver-changes mailing list