[CalendarServer-changes] [13322] CalendarServer/branches/users/sagen/newcua
source_changes at macosforge.org
source_changes at macosforge.org
Fri Apr 18 09:32:45 PDT 2014
Revision: 13322
http://trac.calendarserver.org//changeset/13322
Author: sagen at apple.com
Date: 2014-04-18 09:32:45 -0700 (Fri, 18 Apr 2014)
Log Message:
-----------
More urn:uuid: changes
Modified Paths:
--------------
CalendarServer/branches/users/sagen/newcua/contrib/performance/sqlusage/sqlusage.py
CalendarServer/branches/users/sagen/newcua/twistedcaldav/directory/principal.py
CalendarServer/branches/users/sagen/newcua/twistedcaldav/directory/test/util.py
CalendarServer/branches/users/sagen/newcua/twistedcaldav/sharing.py
CalendarServer/branches/users/sagen/newcua/twistedcaldav/storebridge.py
CalendarServer/branches/users/sagen/newcua/twistedcaldav/upgrade.py
CalendarServer/branches/users/sagen/newcua/txdav/caldav/datastore/scheduling/imip/inbound.py
Modified: CalendarServer/branches/users/sagen/newcua/contrib/performance/sqlusage/sqlusage.py
===================================================================
--- CalendarServer/branches/users/sagen/newcua/contrib/performance/sqlusage/sqlusage.py 2014-04-18 15:25:05 UTC (rev 13321)
+++ CalendarServer/branches/users/sagen/newcua/contrib/performance/sqlusage/sqlusage.py 2014-04-18 16:32:45 UTC (rev 13322)
@@ -286,7 +286,7 @@
for i in range(n - self.currentCount):
index = self.currentCount + i + 2
users.append("user%02d" % (index,))
- uids.append("urn:uuid:user%02d" % (index,))
+ uids.append("urn:x-uid:user%02d" % (index,))
session.addInvitees(URL(path=calendarhref), uids, True)
# Now accept each one
Modified: CalendarServer/branches/users/sagen/newcua/twistedcaldav/directory/principal.py
===================================================================
--- CalendarServer/branches/users/sagen/newcua/twistedcaldav/directory/principal.py 2014-04-18 15:25:05 UTC (rev 13321)
+++ CalendarServer/branches/users/sagen/newcua/twistedcaldav/directory/principal.py 2014-04-18 16:32:45 UTC (rev 13322)
@@ -117,7 +117,10 @@
cua = normalizeCUAddr(origCUAddr)
- if cua.startswith("urn:uuid:"):
+ if cua.startswith("urn:x-uid:"):
+ return "uid", cua[10:]
+
+ elif cua.startswith("urn:uuid:"):
return "guid", uuid.UUID(cua[9:])
elif cua.startswith("mailto:"):
@@ -849,9 +852,7 @@
namespace, name = qname
if qname == davxml.ResourceID.qname():
- # FIXME: should this return a different CUA flavor if guid is not set on this record?
- if hasattr(self.record, "guid"):
- returnValue(davxml.ResourceID(davxml.HRef.fromString("urn:uuid:%s" % (self.record.guid,))))
+ returnValue(davxml.ResourceID(davxml.HRef.fromString("urn:x-uid:%s" % (self.record.uid,))))
elif namespace == calendarserver_namespace:
@@ -1268,11 +1269,7 @@
def canonicalCalendarUserAddress(self):
"""
- Return a CUA for this principal, preferring in this order:
- urn:uuid: form
- mailto: form
- /principal/__uids__/ form
- first in calendarUserAddresses( ) list
+ Return a CUA for this principal
"""
return self.record.canonicalCalendarUserAddress()
Modified: CalendarServer/branches/users/sagen/newcua/twistedcaldav/directory/test/util.py
===================================================================
--- CalendarServer/branches/users/sagen/newcua/twistedcaldav/directory/test/util.py 2014-04-18 15:25:05 UTC (rev 13321)
+++ CalendarServer/branches/users/sagen/newcua/twistedcaldav/directory/test/util.py 2014-04-18 16:32:45 UTC (rev 13322)
@@ -213,6 +213,7 @@
addresses = set(value("addresses"))
if record.hasCalendars:
+ addresses.add("urn:x-uid:%s" % (record.uid,))
addresses.add("urn:uuid:%s" % (record.guid,))
addresses.add("/principals/__uids__/%s/" % (record.uid,))
addresses.add("/principals/%s/%s/" % (record.recordType, record.shortNames[0],))
Modified: CalendarServer/branches/users/sagen/newcua/twistedcaldav/sharing.py
===================================================================
--- CalendarServer/branches/users/sagen/newcua/twistedcaldav/sharing.py 2014-04-18 15:25:05 UTC (rev 13321)
+++ CalendarServer/branches/users/sagen/newcua/twistedcaldav/sharing.py 2014-04-18 16:32:45 UTC (rev 13322)
@@ -65,7 +65,7 @@
@inlineCallbacks
def invitePropertyElement(invitation, includeUID=True):
- userid = "urn:uuid:" + invitation.shareeUID
+ userid = "urn:x-uid:" + invitation.shareeUID
principal = yield self.principalForUID(invitation.shareeUID)
cn = principal.displayName() if principal else invitation.shareeUID
returnValue(customxml.InviteUser(
@@ -91,11 +91,11 @@
invitations = yield self.validateInvites(request, invitations)
ownerPrincipal = yield self.principalForUID(self._newStoreObject.ownerHome().uid())
- # FIXME: use urn:uuid in all cases
+ # FIXME: use urn:x-uid in all cases
if self.isCalendarCollection():
owner = ownerPrincipal.principalURL()
else:
- owner = "urn:uuid:" + ownerPrincipal.principalUID()
+ owner = "urn:x-uid:" + ownerPrincipal.principalUID()
ownerCN = ownerPrincipal.displayName()
returnValue(customxml.Invite(
@@ -437,7 +437,7 @@
invitations = yield self._newStoreObject.allInvitations()
for invitation in invitations:
if invitation.status != _BIND_STATUS_INVALID:
- if not (yield self.validUserIDForShare("urn:uuid:" + invitation.shareeUID, request)):
+ if not (yield self.validUserIDForShare("urn:x-uid:" + invitation.shareeUID, request)):
self.log.error("Invalid sharee detected: {uid}", uid=invitation.shareeUID)
returnValue(invitations)
Modified: CalendarServer/branches/users/sagen/newcua/twistedcaldav/storebridge.py
===================================================================
--- CalendarServer/branches/users/sagen/newcua/twistedcaldav/storebridge.py 2014-04-18 15:25:05 UTC (rev 13321)
+++ CalendarServer/branches/users/sagen/newcua/twistedcaldav/storebridge.py 2014-04-18 16:32:45 UTC (rev 13322)
@@ -1539,7 +1539,7 @@
"""
attendees = (yield self._newStoreCalendarObject.component()).getAttendees()
- attendees = [attendee.split("urn:uuid:")[-1] for attendee in attendees]
+ attendees = [attendee.split("urn:x-uid:")[-1] for attendee in attendees]
document = yield davXMLFromStream(request.stream)
for ace in document.root_element.children:
for child in ace.children:
@@ -3917,7 +3917,7 @@
if jsondata["shared-type"] == "calendar":
owner = ownerPrincipal.principalURL()
else:
- owner = "urn:uuid:" + ownerPrincipal.principalUID()
+ owner = "urn:x-uid:" + ownerPrincipal.principalUID()
shareePrincipal = yield self.principalForUID(jsondata["sharee"])
@@ -3938,7 +3938,7 @@
customxml.DTStamp.fromString(jsondata["dtstamp"]),
customxml.InviteNotification(
customxml.UID.fromString(jsondata["uid"]),
- element.HRef.fromString("urn:uuid:" + jsondata["sharee"]),
+ element.HRef.fromString("urn:x-uid:" + jsondata["sharee"]),
invitationBindStatusToXMLMap[jsondata["status"]](),
customxml.InviteAccess(invitationBindModeToXMLMap[jsondata["access"]]()),
customxml.HostURL(
@@ -3959,7 +3959,7 @@
shareePrincipal = yield self.principalForUID(jsondata["sharee"])
- # FIXME: use urn:uuid always?
+ # FIXME: use urn:x-uid always?
if jsondata["shared-type"] == "calendar":
# Prefer mailto:, otherwise use principal URL
for cua in shareePrincipal.calendarUserAddresses():
@@ -3968,7 +3968,7 @@
else:
cua = shareePrincipal.principalURL()
else:
- cua = "urn:uuid:" + shareePrincipal.principalUID()
+ cua = "urn:x-uid:" + shareePrincipal.principalUID()
commonName = shareePrincipal.displayName()
# record = shareePrincipal.record
Modified: CalendarServer/branches/users/sagen/newcua/twistedcaldav/upgrade.py
===================================================================
--- CalendarServer/branches/users/sagen/newcua/twistedcaldav/upgrade.py 2014-04-18 15:25:05 UTC (rev 13321)
+++ CalendarServer/branches/users/sagen/newcua/twistedcaldav/upgrade.py 2014-04-18 16:32:45 UTC (rev 13322)
@@ -1311,7 +1311,7 @@
txn = request._newStoreTransaction
ownerPrincipal = principal
- cua = "urn:uuid:%s" % (uuid,)
+ cua = "urn:x-uid:%s" % (uuid,)
owner = LocalCalendarUser(
cua, ownerPrincipal,
inbox, ownerPrincipal.scheduleInboxURL()
Modified: CalendarServer/branches/users/sagen/newcua/txdav/caldav/datastore/scheduling/imip/inbound.py
===================================================================
--- CalendarServer/branches/users/sagen/newcua/txdav/caldav/datastore/scheduling/imip/inbound.py 2014-04-18 15:25:05 UTC (rev 13321)
+++ CalendarServer/branches/users/sagen/newcua/txdav/caldav/datastore/scheduling/imip/inbound.py 2014-04-18 16:32:45 UTC (rev 13322)
@@ -327,9 +327,9 @@
fromAddr = attendee[7:]
if organizer.startswith("mailto:"):
toAddr = organizer[7:]
- elif organizer.startswith("urn:uuid:"):
- guid = organizer[9:]
- record = yield self.directory.recordWithGUID(guid)
+ elif organizer.startswith("urn:x-uid:"):
+ uid = organizer[10:]
+ record = yield self.directory.recordWithUID(uid)
try:
if record and record.emailAddresses:
toAddr = list(record.emailAddresses)[0]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140418/9b8bb3c2/attachment-0001.html>
More information about the calendarserver-changes
mailing list