[CalendarServer-changes] [13085] CalendarServer/branches/users/sagen/move2who-4
source_changes at macosforge.org
source_changes at macosforge.org
Mon Mar 31 21:08:22 PDT 2014
Revision: 13085
http://trac.calendarserver.org//changeset/13085
Author: sagen at apple.com
Date: 2014-03-31 21:08:21 -0700 (Mon, 31 Mar 2014)
Log Message:
-----------
Fix structured location test
Modified Paths:
--------------
CalendarServer/branches/users/sagen/move2who-4/calendarserver/tools/gateway.py
CalendarServer/branches/users/sagen/move2who-4/twistedcaldav/directory/test/resources.xml
CalendarServer/branches/users/sagen/move2who-4/txdav/caldav/datastore/sql.py
CalendarServer/branches/users/sagen/move2who-4/txdav/caldav/datastore/test/util.py
Modified: CalendarServer/branches/users/sagen/move2who-4/calendarserver/tools/gateway.py
===================================================================
--- CalendarServer/branches/users/sagen/move2who-4/calendarserver/tools/gateway.py 2014-04-01 02:26:24 UTC (rev 13084)
+++ CalendarServer/branches/users/sagen/move2who-4/calendarserver/tools/gateway.py 2014-04-01 04:08:21 UTC (rev 13085)
@@ -287,6 +287,10 @@
fields[field] = value
+ if FieldName.shortNames not in fields:
+ # No short names were provided, so copy from uid
+ fields[FieldName.shortNames] = [fields[FieldName.uid]]
+
record = DirectoryRecord(self.dir, fields)
yield self.dir.updateRecords([record], create=create)
Modified: CalendarServer/branches/users/sagen/move2who-4/twistedcaldav/directory/test/resources.xml
===================================================================
--- CalendarServer/branches/users/sagen/move2who-4/twistedcaldav/directory/test/resources.xml 2014-04-01 02:26:24 UTC (rev 13084)
+++ CalendarServer/branches/users/sagen/move2who-4/twistedcaldav/directory/test/resources.xml 2014-04-01 04:08:21 UTC (rev 13085)
@@ -87,5 +87,34 @@
<password>location01</password>
<full-name>Room 01</full-name>
</record>
+ <record type="location">
+ <short-name>room-with-address-1</short-name>
+ <uid>room-addr-1</uid>
+ <guid>634A102B-6902-464F-9451-8A86A31628C1</guid>
+ <password>room-addr-2</password>
+ <full-name>Room with Address 1</full-name>
+ <associatedAddress>1-infinite-loop</associatedAddress>
+ </record>
+ <record type="location">
+ <short-name>room-with-address-2</short-name>
+ <uid>room-addr-2</uid>
+ <password>room-addr-2</password>
+ <full-name>Room with Address 2</full-name>
+ <associatedAddress>2-infinite-loop</associatedAddress>
+ </record>
+ <record type="address">
+ <short-name>il1</short-name>
+ <uid>1-infinite-loop</uid>
+ <full-name>One Infinite Loop</full-name>
+ <streetAddress>1 Infinite Loop, Cupertino, CA 95014</streetAddress>
+ <geographicLocation>37.331741,-122.030333</geographicLocation>
+ </record>
+ <record type="address">
+ <short-name>il2</short-name>
+ <uid>2-infinite-loop</uid>
+ <full-name>Two Infinite Loop</full-name>
+ <streetAddress>2 Infinite Loop, Cupertino, CA 95014</streetAddress>
+ <geographicLocation>37.332633,-122.030502</geographicLocation>
+ </record>
</directory>
Modified: CalendarServer/branches/users/sagen/move2who-4/txdav/caldav/datastore/sql.py
===================================================================
--- CalendarServer/branches/users/sagen/move2who-4/txdav/caldav/datastore/sql.py 2014-04-01 02:26:24 UTC (rev 13084)
+++ CalendarServer/branches/users/sagen/move2who-4/txdav/caldav/datastore/sql.py 2014-04-01 04:08:21 UTC (rev 13085)
@@ -2273,15 +2273,16 @@
X-APPLE-STRUCTURED-LOCATION property and update the LOCATION property
to contain the name and street address.
"""
+ dir = self.directoryService()
for sub in component.subcomponents():
for attendee in sub.getAllAttendeeProperties():
if attendee.parameterValue("CUTYPE") == "ROOM":
value = attendee.value()
- loc = yield self.directoryService().recordWithCalendarUserAddress(value)
+ loc = yield dir.recordWithCalendarUserAddress(value)
if loc is not None:
uid = getattr(loc, "associatedAddress", "")
if uid:
- addr = yield self.directoryService().recordWithUID(uid)
+ addr = yield dir.recordWithUID(uid)
if addr is not None:
street = getattr(addr, "streetAddress", "")
geo = getattr(addr, "geographicLocation", "")
Modified: CalendarServer/branches/users/sagen/move2who-4/txdav/caldav/datastore/test/util.py
===================================================================
--- CalendarServer/branches/users/sagen/move2who-4/txdav/caldav/datastore/test/util.py 2014-04-01 02:26:24 UTC (rev 13084)
+++ CalendarServer/branches/users/sagen/move2who-4/txdav/caldav/datastore/test/util.py 2014-04-01 04:08:21 UTC (rev 13085)
@@ -63,14 +63,22 @@
cutype="INDIVIDUAL",
thisServer=True,
server=None,
- extras={},
+ associatedAddress=None,
+ streetAddress=None,
+ geographicLocation=None
):
- super(TestCalendarStoreDirectoryRecord, self).__init__(uid, shortNames, fullName, thisServer, server, extras=extras)
+ super(TestCalendarStoreDirectoryRecord, self).__init__(
+ uid, shortNames, fullName, thisServer, server,
+ )
self.calendarUserAddresses = calendarUserAddresses
self.cutype = cutype
+ self.associatedAddress = associatedAddress
+ self.streetAddress = streetAddress
+ self.geographicLocation = geographicLocation
+
def canonicalCalendarUserAddress(self):
"""
Return a CUA for this record, preferring in this order:
@@ -169,31 +177,23 @@
# Structured Locations
directory.addRecord(TestCalendarStoreDirectoryRecord(
"il1", ("il1",), "1 Infinite Loop", [],
- extras={
- "geo" : "37.331741,-122.030333",
- "streetAddress" : "1 Infinite Loop, Cupertino, CA 95014",
- }
+ geographicLocation="37.331741,-122.030333",
+ streetAddress="1 Infinite Loop, Cupertino, CA 95014"
))
directory.addRecord(TestCalendarStoreDirectoryRecord(
"il2", ("il2",), "2 Infinite Loop", [],
- extras={
- "geo" : "37.332633,-122.030502",
- "streetAddress" : "2 Infinite Loop, Cupertino, CA 95014",
- }
+ geographicLocation="37.332633,-122.030502",
+ streetAddress="2 Infinite Loop, Cupertino, CA 95014"
))
directory.addRecord(TestCalendarStoreDirectoryRecord(
"room1", ("room1",), "Conference Room One",
frozenset(("urn:uuid:room1",)),
- extras={
- "associatedAddress" : "il1",
- }
+ associatedAddress="il1",
))
directory.addRecord(TestCalendarStoreDirectoryRecord(
"room2", ("room2",), "Conference Room Two",
frozenset(("urn:uuid:room2",)),
- extras={
- "associatedAddress" : "il2",
- }
+ associatedAddress="il2",
))
return directory
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140331/5f9a9629/attachment-0001.html>
More information about the calendarserver-changes
mailing list