[CalendarServer-changes] [14707] CalendarServer/branches/release/CalendarServer-6.1-dev

source_changes at macosforge.org source_changes at macosforge.org
Fri Apr 24 12:05:18 PDT 2015


Revision: 14707
          http://trac.calendarserver.org//changeset/14707
Author:   cdaboo at apple.com
Date:     2015-04-24 12:05:18 -0700 (Fri, 24 Apr 2015)
Log Message:
-----------
Merge r14703: vcard parameter list vs tuple fix.

Revision Links:
--------------
    http://trac.calendarserver.org//changeset/14703

Modified Paths:
--------------
    CalendarServer/branches/release/CalendarServer-6.1-dev/txdav/who/vcard.py

Added Paths:
-----------
    CalendarServer/branches/release/CalendarServer-6.1-dev/txdav/who/test/accounts/vcards.xml
    CalendarServer/branches/release/CalendarServer-6.1-dev/txdav/who/test/test_vcard.py

Property Changed:
----------------
    CalendarServer/branches/release/CalendarServer-6.1-dev/


Property changes on: CalendarServer/branches/release/CalendarServer-6.1-dev
___________________________________________________________________
Modified: svn:mergeinfo
   - /CalDAVTester/trunk:11193-11198
/CalendarServer/branches/config-separation:4379-4443
/CalendarServer/branches/egg-info-351:4589-4625
/CalendarServer/branches/generic-sqlstore:6167-6191
/CalendarServer/branches/new-store:5594-5934
/CalendarServer/branches/new-store-no-caldavfile:5911-5935
/CalendarServer/branches/new-store-no-caldavfile-2:5936-5981
/CalendarServer/branches/release/CalendarServer-4.3-dev:10180-10190,10192
/CalendarServer/branches/release/CalendarServer-5.1-dev:11846
/CalendarServer/branches/release/CalendarServer-5.2-dev:11972,12357-12358,12794,12814
/CalendarServer/branches/users/cdaboo/batchupload-6699:6700-7198
/CalendarServer/branches/users/cdaboo/cached-subscription-calendars-5692:5693-5702
/CalendarServer/branches/users/cdaboo/component-set-fixes:8130-8346
/CalendarServer/branches/users/cdaboo/cross-pod-sharing:12038-12191
/CalendarServer/branches/users/cdaboo/directory-cache-on-demand-3627:3628-3644
/CalendarServer/branches/users/cdaboo/fix-no-ischedule:11607-11871
/CalendarServer/branches/users/cdaboo/implicituidrace:8137-8141
/CalendarServer/branches/users/cdaboo/ischedule-dkim:9747-9979
/CalendarServer/branches/users/cdaboo/json:11622-11912
/CalendarServer/branches/users/cdaboo/managed-attachments:9985-10145
/CalendarServer/branches/users/cdaboo/more-sharing-5591:5592-5601
/CalendarServer/branches/users/cdaboo/partition-4464:4465-4957
/CalendarServer/branches/users/cdaboo/performance-tweaks:11824-11836
/CalendarServer/branches/users/cdaboo/pods:7297-7377
/CalendarServer/branches/users/cdaboo/pycalendar:7085-7206
/CalendarServer/branches/users/cdaboo/pycard:7227-7237
/CalendarServer/branches/users/cdaboo/queued-attendee-refreshes:7740-8287
/CalendarServer/branches/users/cdaboo/relative-config-paths-5070:5071-5105
/CalendarServer/branches/users/cdaboo/reverse-proxy-pods:11875-11900
/CalendarServer/branches/users/cdaboo/scheduling-queue-refresh:11783-12557
/CalendarServer/branches/users/cdaboo/shared-calendars-5187:5188-5440
/CalendarServer/branches/users/cdaboo/sharing-in-the-store:11935-12016
/CalendarServer/branches/users/cdaboo/store-scheduling:10876-11129
/CalendarServer/branches/users/cdaboo/timezones:7443-7699
/CalendarServer/branches/users/cdaboo/txn-debugging:8730-8743
/CalendarServer/branches/users/gaya/cleanrevisions:12152-12334
/CalendarServer/branches/users/gaya/groupsharee2:13669-13773
/CalendarServer/branches/users/gaya/sharedgroupfixes:12120-12142
/CalendarServer/branches/users/gaya/sharedgroups-3:11088-11204
/CalendarServer/branches/users/glyph/always-abort-txn-on-error:9958-9969
/CalendarServer/branches/users/glyph/case-insensitive-uid:8772-8805
/CalendarServer/branches/users/glyph/conn-limit:6574-6577
/CalendarServer/branches/users/glyph/contacts-server-merge:4971-5080
/CalendarServer/branches/users/glyph/dalify:6932-7023
/CalendarServer/branches/users/glyph/db-reconnect:6824-6876
/CalendarServer/branches/users/glyph/deploybuild:7563-7572
/CalendarServer/branches/users/glyph/digest-auth-redux:10624-10635
/CalendarServer/branches/users/glyph/disable-quota:7718-7727
/CalendarServer/branches/users/glyph/dont-start-postgres:6592-6614
/CalendarServer/branches/users/glyph/enforce-max-requests:11640-11643
/CalendarServer/branches/users/glyph/hang-fix:11465-11491
/CalendarServer/branches/users/glyph/imip-and-admin-html:7866-7984
/CalendarServer/branches/users/glyph/ipv6-client:9054-9105
/CalendarServer/branches/users/glyph/launchd-wrapper-bis:11413-11436
/CalendarServer/branches/users/glyph/linux-tests:6893-6900
/CalendarServer/branches/users/glyph/log-cleanups:11691-11731
/CalendarServer/branches/users/glyph/migrate-merge:8690-8713
/CalendarServer/branches/users/glyph/misc-portability-fixes:7365-7374
/CalendarServer/branches/users/glyph/more-deferreds-6:6322-6368
/CalendarServer/branches/users/glyph/more-deferreds-7:6369-6445
/CalendarServer/branches/users/glyph/multiget-delete:8321-8330
/CalendarServer/branches/users/glyph/new-export:7444-7485
/CalendarServer/branches/users/glyph/one-home-list-api:10048-10073
/CalendarServer/branches/users/glyph/oracle:7106-7155
/CalendarServer/branches/users/glyph/oracle-nulls:7340-7351
/CalendarServer/branches/users/glyph/other-html:8062-8091
/CalendarServer/branches/users/glyph/parallel-sim:8240-8251
/CalendarServer/branches/users/glyph/parallel-upgrade:8376-8400
/CalendarServer/branches/users/glyph/parallel-upgrade_to_1:8571-8583
/CalendarServer/branches/users/glyph/q:9560-9688
/CalendarServer/branches/users/glyph/queue-locking-and-timing:10204-10289
/CalendarServer/branches/users/glyph/quota:7604-7637
/CalendarServer/branches/users/glyph/sendfdport:5388-5424
/CalendarServer/branches/users/glyph/shared-pool-fixes:8436-8443
/CalendarServer/branches/users/glyph/shared-pool-take2:8155-8174
/CalendarServer/branches/users/glyph/sharedpool:6490-6550
/CalendarServer/branches/users/glyph/sharing-api:9192-9205
/CalendarServer/branches/users/glyph/skip-lonely-vtimezones:8524-8535
/CalendarServer/branches/users/glyph/sql-store:5929-6073
/CalendarServer/branches/users/glyph/start-service-start-loop:11060-11065
/CalendarServer/branches/users/glyph/subtransactions:7248-7258
/CalendarServer/branches/users/glyph/table-alias:8651-8664
/CalendarServer/branches/users/glyph/uidexport:7673-7676
/CalendarServer/branches/users/glyph/unshare-when-access-revoked:10562-10595
/CalendarServer/branches/users/glyph/use-system-twisted:5084-5149
/CalendarServer/branches/users/glyph/uuid-normalize:9268-9296
/CalendarServer/branches/users/glyph/warning-cleanups:11347-11357
/CalendarServer/branches/users/glyph/whenNotProposed:11881-11897
/CalendarServer/branches/users/glyph/xattrs-from-files:7757-7769
/CalendarServer/branches/users/sagen/applepush:8126-8184
/CalendarServer/branches/users/sagen/inboxitems:7380-7381
/CalendarServer/branches/users/sagen/locations-resources:5032-5051
/CalendarServer/branches/users/sagen/locations-resources-2:5052-5061
/CalendarServer/branches/users/sagen/move2who:12819-12860
/CalendarServer/branches/users/sagen/move2who-2:12861-12898
/CalendarServer/branches/users/sagen/move2who-3:12899-12913
/CalendarServer/branches/users/sagen/move2who-4:12914-13157
/CalendarServer/branches/users/sagen/move2who-5:13158-13163
/CalendarServer/branches/users/sagen/newcua:13309-13327
/CalendarServer/branches/users/sagen/newcua-1:13328-13330
/CalendarServer/branches/users/sagen/purge_old_events:6735-6746
/CalendarServer/branches/users/sagen/recordtypes:13648-13656
/CalendarServer/branches/users/sagen/recordtypes-2:13657
/CalendarServer/branches/users/sagen/resource-delegates-4038:4040-4067
/CalendarServer/branches/users/sagen/resource-delegates-4066:4068-4075
/CalendarServer/branches/users/sagen/resources-2:5084-5093
/CalendarServer/branches/users/sagen/testing:10827-10851,10853-10855
/CalendarServer/branches/users/wsanchez/transations:5515-5593
/CalendarServer/trunk:13973,13982,13998,14004,14009,14410,14469,14492,14581
   + /CalDAVTester/trunk:11193-11198
/CalendarServer/branches/config-separation:4379-4443
/CalendarServer/branches/egg-info-351:4589-4625
/CalendarServer/branches/generic-sqlstore:6167-6191
/CalendarServer/branches/new-store:5594-5934
/CalendarServer/branches/new-store-no-caldavfile:5911-5935
/CalendarServer/branches/new-store-no-caldavfile-2:5936-5981
/CalendarServer/branches/release/CalendarServer-4.3-dev:10180-10190,10192
/CalendarServer/branches/release/CalendarServer-5.1-dev:11846
/CalendarServer/branches/release/CalendarServer-5.2-dev:11972,12357-12358,12794,12814
/CalendarServer/branches/users/cdaboo/batchupload-6699:6700-7198
/CalendarServer/branches/users/cdaboo/cached-subscription-calendars-5692:5693-5702
/CalendarServer/branches/users/cdaboo/component-set-fixes:8130-8346
/CalendarServer/branches/users/cdaboo/cross-pod-sharing:12038-12191
/CalendarServer/branches/users/cdaboo/directory-cache-on-demand-3627:3628-3644
/CalendarServer/branches/users/cdaboo/fix-no-ischedule:11607-11871
/CalendarServer/branches/users/cdaboo/implicituidrace:8137-8141
/CalendarServer/branches/users/cdaboo/ischedule-dkim:9747-9979
/CalendarServer/branches/users/cdaboo/json:11622-11912
/CalendarServer/branches/users/cdaboo/managed-attachments:9985-10145
/CalendarServer/branches/users/cdaboo/more-sharing-5591:5592-5601
/CalendarServer/branches/users/cdaboo/partition-4464:4465-4957
/CalendarServer/branches/users/cdaboo/performance-tweaks:11824-11836
/CalendarServer/branches/users/cdaboo/pods:7297-7377
/CalendarServer/branches/users/cdaboo/pycalendar:7085-7206
/CalendarServer/branches/users/cdaboo/pycard:7227-7237
/CalendarServer/branches/users/cdaboo/queued-attendee-refreshes:7740-8287
/CalendarServer/branches/users/cdaboo/relative-config-paths-5070:5071-5105
/CalendarServer/branches/users/cdaboo/reverse-proxy-pods:11875-11900
/CalendarServer/branches/users/cdaboo/scheduling-queue-refresh:11783-12557
/CalendarServer/branches/users/cdaboo/shared-calendars-5187:5188-5440
/CalendarServer/branches/users/cdaboo/sharing-in-the-store:11935-12016
/CalendarServer/branches/users/cdaboo/store-scheduling:10876-11129
/CalendarServer/branches/users/cdaboo/timezones:7443-7699
/CalendarServer/branches/users/cdaboo/txn-debugging:8730-8743
/CalendarServer/branches/users/gaya/cleanrevisions:12152-12334
/CalendarServer/branches/users/gaya/groupsharee2:13669-13773
/CalendarServer/branches/users/gaya/sharedgroupfixes:12120-12142
/CalendarServer/branches/users/gaya/sharedgroups-3:11088-11204
/CalendarServer/branches/users/glyph/always-abort-txn-on-error:9958-9969
/CalendarServer/branches/users/glyph/case-insensitive-uid:8772-8805
/CalendarServer/branches/users/glyph/conn-limit:6574-6577
/CalendarServer/branches/users/glyph/contacts-server-merge:4971-5080
/CalendarServer/branches/users/glyph/dalify:6932-7023
/CalendarServer/branches/users/glyph/db-reconnect:6824-6876
/CalendarServer/branches/users/glyph/deploybuild:7563-7572
/CalendarServer/branches/users/glyph/digest-auth-redux:10624-10635
/CalendarServer/branches/users/glyph/disable-quota:7718-7727
/CalendarServer/branches/users/glyph/dont-start-postgres:6592-6614
/CalendarServer/branches/users/glyph/enforce-max-requests:11640-11643
/CalendarServer/branches/users/glyph/hang-fix:11465-11491
/CalendarServer/branches/users/glyph/imip-and-admin-html:7866-7984
/CalendarServer/branches/users/glyph/ipv6-client:9054-9105
/CalendarServer/branches/users/glyph/launchd-wrapper-bis:11413-11436
/CalendarServer/branches/users/glyph/linux-tests:6893-6900
/CalendarServer/branches/users/glyph/log-cleanups:11691-11731
/CalendarServer/branches/users/glyph/migrate-merge:8690-8713
/CalendarServer/branches/users/glyph/misc-portability-fixes:7365-7374
/CalendarServer/branches/users/glyph/more-deferreds-6:6322-6368
/CalendarServer/branches/users/glyph/more-deferreds-7:6369-6445
/CalendarServer/branches/users/glyph/multiget-delete:8321-8330
/CalendarServer/branches/users/glyph/new-export:7444-7485
/CalendarServer/branches/users/glyph/one-home-list-api:10048-10073
/CalendarServer/branches/users/glyph/oracle:7106-7155
/CalendarServer/branches/users/glyph/oracle-nulls:7340-7351
/CalendarServer/branches/users/glyph/other-html:8062-8091
/CalendarServer/branches/users/glyph/parallel-sim:8240-8251
/CalendarServer/branches/users/glyph/parallel-upgrade:8376-8400
/CalendarServer/branches/users/glyph/parallel-upgrade_to_1:8571-8583
/CalendarServer/branches/users/glyph/q:9560-9688
/CalendarServer/branches/users/glyph/queue-locking-and-timing:10204-10289
/CalendarServer/branches/users/glyph/quota:7604-7637
/CalendarServer/branches/users/glyph/sendfdport:5388-5424
/CalendarServer/branches/users/glyph/shared-pool-fixes:8436-8443
/CalendarServer/branches/users/glyph/shared-pool-take2:8155-8174
/CalendarServer/branches/users/glyph/sharedpool:6490-6550
/CalendarServer/branches/users/glyph/sharing-api:9192-9205
/CalendarServer/branches/users/glyph/skip-lonely-vtimezones:8524-8535
/CalendarServer/branches/users/glyph/sql-store:5929-6073
/CalendarServer/branches/users/glyph/start-service-start-loop:11060-11065
/CalendarServer/branches/users/glyph/subtransactions:7248-7258
/CalendarServer/branches/users/glyph/table-alias:8651-8664
/CalendarServer/branches/users/glyph/uidexport:7673-7676
/CalendarServer/branches/users/glyph/unshare-when-access-revoked:10562-10595
/CalendarServer/branches/users/glyph/use-system-twisted:5084-5149
/CalendarServer/branches/users/glyph/uuid-normalize:9268-9296
/CalendarServer/branches/users/glyph/warning-cleanups:11347-11357
/CalendarServer/branches/users/glyph/whenNotProposed:11881-11897
/CalendarServer/branches/users/glyph/xattrs-from-files:7757-7769
/CalendarServer/branches/users/sagen/applepush:8126-8184
/CalendarServer/branches/users/sagen/inboxitems:7380-7381
/CalendarServer/branches/users/sagen/locations-resources:5032-5051
/CalendarServer/branches/users/sagen/locations-resources-2:5052-5061
/CalendarServer/branches/users/sagen/move2who:12819-12860
/CalendarServer/branches/users/sagen/move2who-2:12861-12898
/CalendarServer/branches/users/sagen/move2who-3:12899-12913
/CalendarServer/branches/users/sagen/move2who-4:12914-13157
/CalendarServer/branches/users/sagen/move2who-5:13158-13163
/CalendarServer/branches/users/sagen/newcua:13309-13327
/CalendarServer/branches/users/sagen/newcua-1:13328-13330
/CalendarServer/branches/users/sagen/purge_old_events:6735-6746
/CalendarServer/branches/users/sagen/recordtypes:13648-13656
/CalendarServer/branches/users/sagen/recordtypes-2:13657
/CalendarServer/branches/users/sagen/resource-delegates-4038:4040-4067
/CalendarServer/branches/users/sagen/resource-delegates-4066:4068-4075
/CalendarServer/branches/users/sagen/resources-2:5084-5093
/CalendarServer/branches/users/sagen/testing:10827-10851,10853-10855
/CalendarServer/branches/users/wsanchez/transations:5515-5593
/CalendarServer/trunk:13973,13982,13998,14004,14009,14410,14469,14492,14581,14703

Copied: CalendarServer/branches/release/CalendarServer-6.1-dev/txdav/who/test/accounts/vcards.xml (from rev 14703, CalendarServer/trunk/txdav/who/test/accounts/vcards.xml)
===================================================================
--- CalendarServer/branches/release/CalendarServer-6.1-dev/txdav/who/test/accounts/vcards.xml	                        (rev 0)
+++ CalendarServer/branches/release/CalendarServer-6.1-dev/txdav/who/test/accounts/vcards.xml	2015-04-24 19:05:18 UTC (rev 14707)
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+Copyright (c) 2006-2015 Apple Inc. All rights reserved.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+ -->
+
+<!DOCTYPE accounts SYSTEM "accounts.dtd">
+
+<directory realm="Test Realm">
+  <record type="user">
+    <uid>admin</uid>
+    <short-name>admin</short-name>
+    <password>admin</password>
+    <full-name>Super User</full-name>
+  </record>
+  <record type="user">
+    <uid>id1</uid>
+    <short-name>id1</short-name>
+    <password>secret</password>
+    <full-name>User 01</full-name>
+  </record>
+  <record type="user">
+    <uid>id2</uid>
+    <short-name>id2</short-name>
+    <password>secret</password>
+    <email>user02 at example.com</email>
+    <full-name>User 02</full-name>
+  </record>
+  <record type="user">
+    <uid>id3</uid>
+    <short-name>id3</short-name>
+    <password>secret</password>
+    <email>user03 at example.com</email>
+    <email>user03+plus at example.com</email>
+    <full-name>User 03</full-name>
+  </record>
+  <record type="user">
+    <uid>id4</uid>
+    <short-name>id4</short-name>
+    <password>secret</password>
+    <full-name>User 04</full-name>
+	<street-address>20300 Stevens Creek Blvd, Cupertino, CA 95014</street-address>
+  </record>
+</directory>

Copied: CalendarServer/branches/release/CalendarServer-6.1-dev/txdav/who/test/test_vcard.py (from rev 14703, CalendarServer/trunk/txdav/who/test/test_vcard.py)
===================================================================
--- CalendarServer/branches/release/CalendarServer-6.1-dev/txdav/who/test/test_vcard.py	                        (rev 0)
+++ CalendarServer/branches/release/CalendarServer-6.1-dev/txdav/who/test/test_vcard.py	2015-04-24 19:05:18 UTC (rev 14707)
@@ -0,0 +1,187 @@
+##
+# Copyright (c) 2014-2015 Apple Inc. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+##
+
+from __future__ import absolute_import
+from __future__ import print_function
+from twisted.internet.defer import inlineCallbacks
+from twisted.python.filepath import FilePath
+from twisted.trial import unittest
+from txdav.common.datastore.test.util import CommonCommonTests, \
+    populateCalendarsFrom, populateAddressBooksFrom
+from txdav.who.vcard import vCardFromRecord
+import os
+from twistedcaldav.config import config
+
+
+
+class TestVCard(CommonCommonTests, unittest.TestCase):
+    """
+    Tests for L{twext.who.vcard}.
+    """
+
+    @inlineCallbacks
+    def setUp(self):
+        yield super(TestVCard, self).setUp()
+
+        accountsFilePath = FilePath(
+            os.path.join(os.path.dirname(__file__), "accounts")
+        )
+        yield self.buildStoreAndDirectory(
+            accounts=accountsFilePath.child("vcards.xml"),
+        )
+
+        yield self.populate()
+
+
+    @inlineCallbacks
+    def populate(self):
+        yield populateCalendarsFrom(self.requirements, self.storeUnderTest())
+        yield populateAddressBooksFrom(self.requirements, self.storeUnderTest())
+
+    requirements = {
+        "id1" : None,
+    }
+
+
+    @inlineCallbacks
+    def test_basicVcard(self):
+        vcard_result = """BEGIN:VCARD
+VERSION:3.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+UID:id1
+FN:User 01
+KIND:individual
+N:01;User;;;
+END:VCARD
+""".replace("\n", "\r\n")
+
+        record = yield self.directory.recordWithUID("id1")
+        vcard = yield vCardFromRecord(record)
+        self.assertEqual(str(vcard), vcard_result)
+
+
+    @inlineCallbacks
+    def test_parentURI(self):
+        vcard_result = """BEGIN:VCARD
+VERSION:3.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+UID:id1
+FN:User 01
+KIND:individual
+N:01;User;;;
+SOURCE:https://example.com:8443/contacts/id1.vcf
+END:VCARD
+""".replace("\n", "\r\n")
+
+        self.patch(config, "EnableSSL", True)
+        self.patch(config, "SSLPort", 8443)
+        self.patch(config, "ServerHostName", "example.com")
+
+        record = yield self.directory.recordWithUID("id1")
+        vcard = yield vCardFromRecord(record, parentURI="/contacts")
+        self.assertEqual(str(vcard), vcard_result)
+
+
+    @inlineCallbacks
+    def test_forceKind(self):
+        vcard_result = """BEGIN:VCARD
+VERSION:3.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+UID:id1
+FN:User 01
+KIND:foobar
+N:01;User;;;
+END:VCARD
+""".replace("\n", "\r\n")
+
+        record = yield self.directory.recordWithUID("id1")
+        vcard = yield vCardFromRecord(record, forceKind="foobar")
+        self.assertEqual(str(vcard), vcard_result)
+
+
+    @inlineCallbacks
+    def test_addProps(self):
+        vcard_result = """BEGIN:VCARD
+VERSION:3.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+UID:id1
+FN:User 01
+KEY:private
+KIND:individual
+N:01;User;;;
+END:VCARD
+""".replace("\n", "\r\n")
+
+        record = yield self.directory.recordWithUID("id1")
+        vcard = yield vCardFromRecord(record, addProps={"KEY": "private"})
+        self.assertEqual(str(vcard), vcard_result)
+
+
+    @inlineCallbacks
+    def test_email(self):
+        vcard_result = """BEGIN:VCARD
+VERSION:3.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+UID:id2
+EMAIL;TYPE=INTERNET,PREF,WORK:user02 at example.com
+FN:User 02
+KIND:individual
+N:02;User;;;
+END:VCARD
+""".replace("\n", "\r\n")
+
+        record = yield self.directory.recordWithUID("id2")
+        vcard = yield vCardFromRecord(record)
+        self.assertEqual(str(vcard), vcard_result)
+
+
+    @inlineCallbacks
+    def test_multipleemail(self):
+        vcard_result = """BEGIN:VCARD
+VERSION:3.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+UID:id3
+EMAIL;TYPE=INTERNET,PREF,WORK:user03 at example.com
+EMAIL;TYPE=INTERNET,WORK:user03+plus at example.com
+FN:User 03
+KIND:individual
+N:03;User;;;
+END:VCARD
+""".replace("\n", "\r\n")
+
+        record = yield self.directory.recordWithUID("id3")
+        vcard = yield vCardFromRecord(record)
+        self.assertEqual(str(vcard), vcard_result)
+
+
+    @inlineCallbacks
+    def test_adr(self):
+        vcard_result = """BEGIN:VCARD
+VERSION:3.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+UID:id4
+ADR;LABEL="20300 Stevens Creek Blvd, Cupertino, CA 95014";TYPE=PARCEL,POST
+ AL,PREF,WORK:;;20300 Stevens Creek Blvd\\, Cupertino\\, CA 95014;;;;
+FN:User 04
+KIND:individual
+LABEL;TYPE=PARCEL,POSTAL:20300 Stevens Creek Blvd\\, Cupertino\\, CA 95014
+N:04;User;;;
+END:VCARD
+""".replace("\n", "\r\n")
+
+        record = yield self.directory.recordWithUID("id4")
+        vcard = yield vCardFromRecord(record)
+        self.assertEqual(str(vcard), vcard_result)

Modified: CalendarServer/branches/release/CalendarServer-6.1-dev/txdav/who/vcard.py
===================================================================
--- CalendarServer/branches/release/CalendarServer-6.1-dev/txdav/who/vcard.py	2015-04-24 17:12:10 UTC (rev 14706)
+++ CalendarServer/branches/release/CalendarServer-6.1-dev/txdav/who/vcard.py	2015-04-24 19:05:18 UTC (rev 14707)
@@ -212,7 +212,7 @@
     country = None
 
     if extended or street or city or region or postalcode or country or params:
-        params["TYPE"] = ("WORK", "PREF", "POSTAL", "PARCEL",)
+        params["TYPE"] = ["WORK", "PREF", "POSTAL", "PARCEL", ]
         vcard.addProperty(
             Property(
                 "ADR", Adr(
@@ -241,11 +241,11 @@
     #     3.3.1 TEL
 
     # 3.3.2 EMAIL
-    preferredWorkParams = {"TYPE": ("WORK", "PREF", "INTERNET",), }
-    workParams = {"TYPE": ("WORK", "INTERNET",), }
+    preferredWorkParams = {"TYPE": ["WORK", "PREF", "INTERNET", ], }
+    workParams = {"TYPE": ["WORK", "INTERNET", ], }
     params = preferredWorkParams
     for emailAddress in record.fields.get(FieldName.emailAddresses, ()):
-        addUniqueProperty(Property("EMAIL", emailAddress.encode("utf-8"), params=params), ignoredParameters={"TYPE": ("PREF",)})
+        addUniqueProperty(Property("EMAIL", emailAddress.encode("utf-8"), params=params), ignoredParameters={"TYPE": ["PREF", ]})
         params = workParams
 
     # UNIMPLEMENTED:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20150424/590b5d11/attachment-0001.html>


More information about the calendarserver-changes mailing list