[CalendarServer-changes] [4984] CalendarServer/branches/users/glyph/contacts-server-merge/ twistedcaldav/method

source_changes at macosforge.org source_changes at macosforge.org
Fri Jan 29 10:52:34 PST 2010


Revision: 4984
          http://trac.macosforge.org/projects/calendarserver/changeset/4984
Author:   glyph at apple.com
Date:     2010-01-29 10:52:31 -0800 (Fri, 29 Jan 2010)
Log Message:
-----------
temporary workaround for the fact that responseForHref has a different signature in Contacts Server

Modified Paths:
--------------
    CalendarServer/branches/users/glyph/contacts-server-merge/twistedcaldav/method/report_addressbook_multiget.py
    CalendarServer/branches/users/glyph/contacts-server-merge/twistedcaldav/method/report_addressbook_query.py
    CalendarServer/branches/users/glyph/contacts-server-merge/twistedcaldav/method/report_common.py

Modified: CalendarServer/branches/users/glyph/contacts-server-merge/twistedcaldav/method/report_addressbook_multiget.py
===================================================================
--- CalendarServer/branches/users/glyph/contacts-server-merge/twistedcaldav/method/report_addressbook_multiget.py	2010-01-29 18:41:25 UTC (rev 4983)
+++ CalendarServer/branches/users/glyph/contacts-server-merge/twistedcaldav/method/report_addressbook_multiget.py	2010-01-29 18:52:31 UTC (rev 4984)
@@ -177,7 +177,7 @@
                                     break;
 
                             if matchingRecord:
-                                yield report_common.responseForHref(request, responses, href, matchingRecord, propertiesForResource, propertyreq, vcard=matchingRecord.vCard())
+                                yield report_common.responseForHrefAB(request, responses, href, matchingRecord, propertiesForResource, propertyreq, vcard=matchingRecord.vCard())
                             else:
                                 responses.append(davxml.StatusResponse(href, davxml.Status.fromResponseCode(responsecode.NOT_FOUND)))
                         # done with live, noncaching directoryBackedAddressBook query
@@ -225,7 +225,7 @@
         
                     # Get properties for all valid readable resources
                     for resource, href in ok_resources:
-                        yield report_common.responseForHref(request, responses, davxml.HRef.fromString(href), resource, propertiesForResource, propertyreq)
+                        yield report_common.responseForHrefAB(request, responses, davxml.HRef.fromString(href), resource, propertiesForResource, propertyreq)
                                 
                     # Indicate error for all valid non-readable resources
                     for ignore_resource, href in bad_resources: #@UnusedVariable
@@ -305,7 +305,7 @@
                     responses.append(davxml.StatusResponse(href, davxml.Status.fromResponseCode(responsecode.FORBIDDEN)))
                     continue
         
-                yield report_common.responseForHref(request, responses, href, child, propertiesForResource, propertyreq)
+                yield report_common.responseForHrefAB(request, responses, href, child, propertiesForResource, propertyreq)
 
     retValue = MultiStatusResponse(responses)
     

Modified: CalendarServer/branches/users/glyph/contacts-server-merge/twistedcaldav/method/report_addressbook_query.py
===================================================================
--- CalendarServer/branches/users/glyph/contacts-server-merge/twistedcaldav/method/report_addressbook_query.py	2010-01-29 18:41:25 UTC (rev 4983)
+++ CalendarServer/branches/users/glyph/contacts-server-merge/twistedcaldav/method/report_addressbook_query.py	2010-01-29 18:52:31 UTC (rev 4984)
@@ -131,7 +131,7 @@
                 else:
                     href = davxml.HRef.fromString(uri)
             
-                return report_common.responseForHref(request, responses, href, resource, propertiesForResource, query, vcard=vcard)
+                return report_common.responseForHrefAB(request, responses, href, resource, propertiesForResource, query, vcard=vcard)
             else:
                 return succeed(None)
             
@@ -150,7 +150,7 @@
                     # Check size of results is within limit
                     checkMaxResults()
                    
-                    yield report_common.responseForHref(request, responses, vCardRecord.hRef(), vCardRecord, propertiesForResource, query, vcard=vCardRecord.vCard())
+                    yield report_common.responseForHrefAB(request, responses, vCardRecord.hRef(), vCardRecord, propertiesForResource, query, vcard=vCardRecord.vCard())
  
  
             
@@ -293,4 +293,3 @@
     self.log_info("Timing: CARDDAV:addressbook-query Report total: %.1f ms" % (elaspedTime*1000,))
 
     returnValue(retValue)
-    
\ No newline at end of file

Modified: CalendarServer/branches/users/glyph/contacts-server-merge/twistedcaldav/method/report_common.py
===================================================================
--- CalendarServer/branches/users/glyph/contacts-server-merge/twistedcaldav/method/report_common.py	2010-01-29 18:41:25 UTC (rev 4983)
+++ CalendarServer/branches/users/glyph/contacts-server-merge/twistedcaldav/method/report_common.py	2010-01-29 18:52:31 UTC (rev 4984)
@@ -137,7 +137,7 @@
         yield apply(addrresource, uri)
 
 
-def responseForHref(request, responses, href, resource, calendar, timezone, propertiesForResource, propertyreq, isowner=True):
+def responseForHref(request, responses, href, resource, calendar, timezone, propertiesForResource, propertyreq, isowner=True, vcard=None):
     """
     Create an appropriate property status response for the given resource.
 
@@ -151,7 +151,11 @@
     @param vcard: the L{Component} for the vcard for the resource. This may be None
         if the vcard has not already been read in, in which case the resource
         will be used to get the vcard if needed.
-    @param propertiesForResource: the method to use to get the list of properties to return.
+
+    @param propertiesForResource: the method to use to get the list of
+        properties to return.  This is a callable object with a signature
+        matching that of L{allPropertiesForResource}.
+
     @param propertyreq: the L{PropertyContainer} element for the properties of interest.
     @param isowner: C{True} if the authorized principal making the request is the DAV:owner,
         C{False} otherwise.
@@ -172,13 +176,28 @@
         if propstats:
             responses.append(davxml.PropertyStatusResponse(href, *propstats))
 
-    d = propertiesForResource(request, propertyreq, resource, calendar, timezone, isowner)
+    d = propertiesForResource(request, propertyreq, resource, calendar, timezone, vcard, isowner)
     d.addCallback(_defer)
     return d
 
+
+
+def responseForHrefAB(request, responses, href, resource, propertiesForResource,
+                      propertyreq, calendar=None, timezone=None, vcard=None,
+                      isowner=True):
+    """
+    Legacy wrapper for compatibility of signature of L{responseForHref} in
+    Contacts Server.
+    """
+    return responseForHref(request, responses, href, resource, calendar,
+                           timezone, propertiesForResource, propertyreq, isowner, vcard)
+
+
+
 def allPropertiesForResource(request, prop, resource, calendar=None, timezone=None, vcard=None, isowner=True):
     """
     Return all (non-hidden) properties for the specified resource.
+
     @param request: the L{IRequest} for the current request.
     @param prop: the L{PropertyContainer} element for the properties of interest.
     @param resource: the L{CalDAVFile} for the targeted resource.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20100129/496b5365/attachment-0001.html>


More information about the calendarserver-changes mailing list