[CalendarServer-changes] [7283] CalendarServer/trunk/calendarserver/tools/notifications.py
source_changes at macosforge.org
source_changes at macosforge.org
Fri Apr 1 17:07:02 PDT 2011
Revision: 7283
http://trac.macosforge.org/projects/calendarserver/changeset/7283
Author: sagen at apple.com
Date: 2011-04-01 17:07:02 -0700 (Fri, 01 Apr 2011)
Log Message:
-----------
Don't bother looking up push info for delegated addressbooks -- there is no such thing.
Modified Paths:
--------------
CalendarServer/trunk/calendarserver/tools/notifications.py
Modified: CalendarServer/trunk/calendarserver/tools/notifications.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/notifications.py 2011-04-01 21:32:14 UTC (rev 7282)
+++ CalendarServer/trunk/calendarserver/tools/notifications.py 2011-04-02 00:07:02 UTC (rev 7283)
@@ -317,11 +317,16 @@
@inlineCallbacks
def startService(self):
try:
- principals = (yield self.getProxyFor())
- principals.add("/principals/users/%s/" % (self.username,))
paths = set()
- for principal in principals:
- name, homes = (yield self.getPrincipalDetails(principal))
+ principal = "/principals/users/%s/" % (self.username,)
+ name, homes = (yield self.getPrincipalDetails(principal))
+ if self.verbose:
+ print name, homes
+ for home in homes:
+ paths.add(home)
+ for principal in (yield self.getProxyFor()):
+ name, homes = (yield self.getPrincipalDetails(principal,
+ includeCardDAV=False))
if self.verbose:
print name, homes
for home in homes:
@@ -341,7 +346,7 @@
reactor.stop()
@inlineCallbacks
- def getPrincipalDetails(self, path):
+ def getPrincipalDetails(self, path, includeCardDAV=True):
"""
Given a principal path, retrieve and return the corresponding
displayname and set of calendar/addressbook homes.
@@ -382,12 +387,13 @@
href = href.text
if href:
homes.append(href)
- addressbookHomeSet = prop.find("{urn:ietf:params:xml:ns:carddav}addressbook-home-set")
- if addressbookHomeSet is not None:
- for href in addressbookHomeSet.findall("{DAV:}href"):
- href = href.text
- if href:
- homes.append(href)
+ if includeCardDAV:
+ addressbookHomeSet = prop.find("{urn:ietf:params:xml:ns:carddav}addressbook-home-set")
+ if addressbookHomeSet is not None:
+ for href in addressbookHomeSet.findall("{DAV:}href"):
+ href = href.text
+ if href:
+ homes.append(href)
displayName = prop.find("{DAV:}displayname")
if displayName is not None:
displayName = displayName.text
@@ -425,7 +431,7 @@
</A:prop>
</A:propfind>
"""
- path = "principals/users/%s" % (self.username,)
+ path = "/principals/users/%s/" % (self.username,)
try:
responseBody = (yield self.makeRequest(path, "PROPFIND", headers,
@@ -567,7 +573,7 @@
def makeRequest(self, path, method, headers, body):
scheme = "https:" if self.useSSL else "http:"
- url = "%s//%s:%d/%s/" % (scheme, self.host, self.port, path)
+ url = "%s//%s:%d%s" % (scheme, self.host, self.port, path)
caldavFactory = client.HTTPClientFactory(url, method=method,
headers=headers, postdata=body, agent="Push Monitor")
caldavFactory.username = self.authname
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20110401/0c2a8d0a/attachment-0001.html>
More information about the calendarserver-changes
mailing list