[CalendarServer-changes] [11804] CalendarServer/branches/users/gaya/xmldirectorybacker

source_changes at macosforge.org source_changes at macosforge.org
Thu Oct 10 12:02:51 PDT 2013


Revision: 11804
          http://trac.calendarserver.org//changeset/11804
Author:   gaya at apple.com
Date:     2013-10-10 12:02:50 -0700 (Thu, 10 Oct 2013)
Log Message:
-----------
remove support for ldapdirectorybacker, appleInternalServer config key, clean whitespace

Modified Paths:
--------------
    CalendarServer/branches/users/gaya/xmldirectorybacker/conf/carddav-odtest.plist
    CalendarServer/branches/users/gaya/xmldirectorybacker/twistedcaldav/directory/directory.py
    CalendarServer/branches/users/gaya/xmldirectorybacker/twistedcaldav/directory/opendirectorybacker.py
    CalendarServer/branches/users/gaya/xmldirectorybacker/twistedcaldav/directory/xmldirectorybacker.py
    CalendarServer/branches/users/gaya/xmldirectorybacker/twistedcaldav/stdconfig.py

Removed Paths:
-------------
    CalendarServer/branches/users/gaya/xmldirectorybacker/conf/carddav-ldaptest.plist
    CalendarServer/branches/users/gaya/xmldirectorybacker/conf/carddav-ldaptest2.plist
    CalendarServer/branches/users/gaya/xmldirectorybacker/twistedcaldav/directory/ldapdirectorybacker.py

Deleted: CalendarServer/branches/users/gaya/xmldirectorybacker/conf/carddav-ldaptest.plist
===================================================================
--- CalendarServer/branches/users/gaya/xmldirectorybacker/conf/carddav-ldaptest.plist	2013-10-10 18:51:46 UTC (rev 11803)
+++ CalendarServer/branches/users/gaya/xmldirectorybacker/conf/carddav-ldaptest.plist	2013-10-10 19:02:50 UTC (rev 11804)
@@ -1,1131 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
-    Copyright (c) 2006-2013 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 plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-  <dict>
-
-    <!--
-        Public network address information
-
-        This is the server's public network address, which is provided to
-        clients in URLs and the like.  It may or may not be the network
-        address that the server is listening to directly, though it is by
-        default.  For example, it may be the address of a load balancer or
-        proxy which forwards connections to the server.
-      -->
-
-    <!-- Network host name [empty = system host name] -->
-    <key>ServerHostName</key>
-    <string>localhost</string> <!-- The hostname clients use when connecting -->
-
-    <!-- Enable Calendars -->
-    <key>EnableCalDAV</key>
-    <true/>
-
-    <!-- Enable AddressBooks -->
-    <key>EnableCardDAV</key>
-    <true/>
-
-    <!-- HTTP port [0 = disable HTTP] -->
-    <key>HTTPPort</key>
-    <integer>8008</integer>
-
-    <!-- SSL port [0 = disable HTTPS] -->
-    <!-- (Must also configure SSLCertificate and SSLPrivateKey below) -->
-    <key>SSLPort</key>
-    <integer>8443</integer>
-
-    <!-- Enable listening on SSL port(s) -->
-    <key>EnableSSL</key>
-    <true/>
-
-    <!-- Redirect non-SSL ports to an SSL port (if configured for SSL) -->
-    <key>RedirectHTTPToHTTPS</key>
-    <false/>
-
-
-    <!--
-        Network address configuration information
-
-        This configures the actual network address that the server binds to.
-      -->
-
-    <!-- List of IP addresses to bind to [empty = all] -->
-    <key>BindAddresses</key>
-    <array>
-    </array>
-
-    <!-- List of port numbers to bind to for HTTP [empty = same as "Port"] -->
-    <key>BindHTTPPorts</key>
-    <array>
-        <integer>8008</integer>
-        <integer>8800</integer>
-    </array>
-
-    <!-- List of port numbers to bind to for SSL [empty = same as "SSLPort"] -->
-    <key>BindSSLPorts</key>
-    <array>
-        <integer>8443</integer>
-        <integer>8843</integer>
-    </array>
-
-
-    <!--
-        Data Store
-      -->
-
-    <!-- Server root -->
-    <key>ServerRoot</key>
-    <string>./data</string>
-
-    <!-- Database connection -->
-    <!--
-    <key>DBType</key>
-    <string>postgres</string>
-    <key>DSN</key>
-    <string>:caldav:caldav:::</string>
-     -->
-
-    <!-- Data root -->
-    <key>DataRoot</key>
-    <string>Data</string>
-
-    <!-- Database root -->
-    <key>DatabaseRoot</key>
-    <string>Database</string>
-
-    <!-- Document root -->
-    <key>DocumentRoot</key>
-    <string>Documents</string>
-
-    <!-- Configuration root -->
-    <key>ConfigRoot</key>
-    <string>./conf</string>
-
-    <!-- Run root -->
-    <key>RunRoot</key>
-    <string>Logs/state</string>
-
-    <!-- Child aliases -->
-    <key>Aliases</key>
-    <array>
-      <!--
-      <dict>
-        <key>url</key>
-        <string>/foo</string>
-        <key>path</key>
-        <string>/path/to/foo</string>
-      </dict>
-       -->
-    </array>
-
-
-    <!--
-        Quotas and limits
-      -->
-
-    <!-- User quota (in bytes) [0 = no quota] applies to attachments only -->
-    <key>UserQuota</key>
-    <integer>104857600</integer><!-- 100Mb -->
-
-    <!-- Maximum number of calendars/address books allowed in a home -->
-    <!-- 0 for no limit -->
-    <key>MaxCollectionsPerHome</key>
-    <integer>50</integer>
-
-    <!-- Maximum number of resources in a calendar/address book -->
-    <!-- 0 for no limit -->
-    <key>MaxResourcesPerCollection</key>
-    <integer>10000</integer>
-
-    <!-- Maximum resource size (in bytes) -->
-    <key>MaxResourceSize</key>
-    <integer>1048576</integer> <!-- 1Mb -->
-
-    <!-- Maximum number of unique attendees per entire event -->
-    <!-- 0 for no limit -->
-    <key>MaxAttendeesPerInstance</key>
-    <integer>100</integer>
-
-    <!-- Maximum number of instances allowed during expansion -->
-    <!-- 0 for no limit -->
-    <key>MaxAllowedInstances</key>
-    <integer>3000</integer>
-
-    <!--
-        Directory service
-
-        A directory service provides information about principals (eg.
-        users, groups, locations and resources) to the server.
-
-        A variety of directory services are available for use.
-      -->
-
-    <!-- XML File Directory Service -->
-    <key>DirectoryService</key>
-    <dict>
-      <key>type</key>
-      <string>twistedcaldav.directory.xmlfile.XMLDirectoryService</string>
-      
-      <key>params</key>
-      <dict>
-        <key>xmlFile</key>
-        <string>./conf/auth/accounts-test.xml</string>
-      </dict>
-    </dict>
-    
-    <!-- Open Directory Service (Mac OS X) -->
-    <!--
-    <key>DirectoryService</key>
-    <dict>
-      <key>type</key>
-      <string>twistedcaldav.directory.appleopendirectory.OpenDirectoryService</string>
-      
-      <key>params</key>
-      <dict>
-        <key>node</key>
-        <string>/Search</string>
-        <key>cacheTimeout</key>
-        <integer>10</integer>
-      </dict>
-    </dict>
-    -->
-
-    <!--  OpenLDAP Directory Service -->
-    <!--
-    <key>DirectoryService</key>
-    <dict>
-      <key>type</key>
-      <string>twistedcaldav.directory.ldapdirectory.LdapDirectoryService</string>
-
-      <key>params</key>
-      <dict>
-        <key>recordTypes</key>
-        <array>
-           <string>users</string>
-           <string>groups</string>
-           <string>locations</string>
-           <string>resources</string>
-        </array>
-        <key>cacheTimeout</key>
-        <integer>10</integer>
-        <key>uri</key>
-        <string>ldap://ldapserver.example.com/</string>
-        <key>tls</key>
-        <false/>
-        <key>tlsCACertFile</key>
-        <string></string>
-        <key>tlsCACertDir</key>
-        <string></string>
-        <key>tlsRequireCert</key>
-        <string>never</string>
-        <key>credentials</key>
-        <dict>
-          <key>dn</key>
-          <string>uid=admin,ou=people,o=example.com</string>
-          <key>password</key>
-          <string>PASSWORD</string>
-        </dict>
-        <key>rdnSchema</key>
-        <dict>
-          <key>base</key>
-          <string>o=example.com</string>
-          <key>guidAttr</key>
-          <string>GUID</string>
-          <key>users</key>
-          <dict>
-            <key>rdn</key>
-            <string>ou=people</string>
-            <key>mapping</key>
-            <dict>
-                <key>recordName</key>
-                <string>uid</string>
-                <key>fullName</key>
-                <string>cn</string>
-                <key>emailAddresses</key>
-                <array>
-                    <string>mail</string>
-                    <string>mailAlias</string>
-                </array>
-                <key>firstName</key>
-                <string>givenName</string>
-                <key>lastName</key>
-                <string>sn</string>
-            </dict>
-          </dict>
-          <key>groups</key>
-          <dict>
-            <key>rdn</key>
-            <string>ou=groups</string>
-            <key>mapping</key>
-            <dict>
-                <key>recordName</key>
-                <string>cn</string>
-                <key>fullName</key>
-                <string>cn</string>
-                <key>emailAddresses</key>
-                <array>
-                    <string>mail</string>
-                    <string>mailAlias</string>
-                </array>
-                <key>firstName</key>
-                <string></string>
-                <key>lastName</key>
-                <string></string>
-            </dict>
-          </dict>
-          <key>locations</key>
-          <dict>
-            <key>rdn</key>
-            <string>ou=locations</string>
-            <key>mapping</key>
-            <dict>
-                <key>recordName</key>
-                <string>cn</string>
-                <key>fullName</key>
-                <string>cn</string>
-                <key>emailAddresses</key>
-                <array>
-                </array>
-                <key>firstName</key>
-                <string></string>
-                <key>lastName</key>
-                <string></string>
-            </dict>
-          </dict>
-          <key>resources</key>
-          <dict>
-            <key>rdn</key>
-            <string>ou=resources</string>
-            <key>mapping</key>
-            <dict>
-                <key>recordName</key>
-                <string>cn</string>
-                <key>fullName</key>
-                <string>cn</string>
-                <key>emailAddresses</key>
-                <array>
-                </array>
-                <key>firstName</key>
-                <string></string>
-                <key>lastName</key>
-                <string></string>
-            </dict>
-          </dict>
-        </dict>
-        <key>groupSchema</key>
-        <dict>
-          <key>membersAttr</key>
-          <string>uniqueMember</string>
-          <key>nestedGroupsAttr</key>
-          <string></string>
-          <key>memberIdAttr</key>
-          <string></string>
-        </dict>
-        <key>resourceSchema</key>
-        <dict>
-         <key>resourceInfoAttr</key>
-         <string></string>
-         <key>autoScheduleAttr</key>
-         <string></string>
-         <key>autoScheduleEnabledValue</key>
-         <string></string>
-         <key>proxyAttr</key>
-         <string></string>
-         <key>readOnlyProxyAttr</key>
-         <string></string>
-        </dict>
-      </dict>
-    </dict>
-    -->
-
-    <!-- Resource and Location Service -->
-    <key>ResourceService</key>
-    <dict>
-      <key>Enabled</key>
-      <true/>
-      <key>type</key>
-      <string>twistedcaldav.directory.xmlfile.XMLDirectoryService</string>
-      
-      <key>params</key>
-      <dict>
-        <key>xmlFile</key>
-        <string>./conf/auth/resources-test.xml</string>
-      </dict>
-    </dict>
-
-    <!-- XML File Augment Service -->
-    <key>AugmentService</key>
-    <dict>
-      <key>type</key>
-      <string>twistedcaldav.directory.augment.AugmentXMLDB</string>
-      
-      <key>params</key>
-      <dict>
-        <key>xmlFiles</key>
-        <array>
-	      <string>./conf/auth/augments-test.xml</string>
-        </array>
-      </dict>
-    </dict>
-
-    <!-- Sqlite Augment Service -->
-    <!--
-    <key>AugmentService</key>
-    <dict>
-      <key>type</key>
-      <string>twistedcaldav.directory.augment.AugmentSqliteDB</string>
-      
-      <key>params</key>
-      <dict>
-        <key>dbpath</key>
-        <string>./conf/auth/augments.sqlite</string>
-      </dict>
-    </dict>
-     -->
-
-    <!-- PostgreSQL Augment Service -->
-    <!--
-    <key>AugmentService</key>
-    <dict>
-      <key>type</key>
-      <string>twistedcaldav.directory.augment.AugmentPostgreSQLDB</string>
-      
-      <key>params</key>
-      <dict>
-        <key>host</key>
-        <string>localhost</string>
-        <key>database</key>
-        <string>augments</string>
-      </dict>
-    </dict>
-     -->
-
-    <!-- Sqlite ProxyDB Service -->
-    <key>ProxyDBService</key>
-    <dict>
-      <key>type</key>
-      <string>twistedcaldav.directory.calendaruserproxy.ProxySqliteDB</string>
-      
-      <key>params</key>
-      <dict>
-        <key>dbpath</key>
-        <string>proxies.sqlite</string>
-      </dict>
-    </dict>
-
-    <!-- PostgreSQL ProxyDB Service -->
-    <!--
-    <key>ProxyDBService</key>
-    <dict>
-      <key>type</key>
-      <string>twistedcaldav.directory.calendaruserproxy.ProxyPostgreSQLDB</string>
-      
-      <key>params</key>
-      <dict>
-        <key>host</key>
-        <string>localhost</string>
-        <key>database</key>
-        <string>proxies</string>
-      </dict>
-    </dict>
-     -->
-
-    <key>ProxyLoadFromFile</key>
-    <string>./conf/auth/proxies-test.xml</string>
-
-
-    <!--
-        Special principals
-
-        These principals are granted special access and/or perform
-        special roles on the server.
-      -->
-
-    <!-- Principals with "DAV:all" access (relative URLs) -->
-    <key>AdminPrincipals</key>
-    <array>
-      <string>/principals/__uids__/admin/</string>
-    </array>
-
-    <!-- Principals with "DAV:read" access (relative URLs) -->
-    <key>ReadPrincipals</key>
-    <array>
-      <!-- <string>/principals/__uids__/983C8238-FB6B-4D92-9242-89C0A39E5F81/</string> -->
-    </array>
-
-    <!-- Create "proxy access" principals -->
-    <key>EnableProxyPrincipals</key>
-    <true/>
-
-
-    <!--
-        Permissions
-      -->
-
-    <!-- Anonymous read access for root resource -->
-    <key>EnableAnonymousReadRoot</key>
-    <true/>
-
-    <!-- Anonymous read access for resource hierarchy -->
-    <key>EnableAnonymousReadNav</key>
-    <false/>
-
-    <!-- Enables directory listings for principals -->
-    <key>EnablePrincipalListings</key>
-    <true/>
-
-    <!-- Render calendar collections as a monolithic iCalendar object -->
-    <key>EnableMonolithicCalendars</key>
-    <true/>
-
-
-    <!--
-        Authentication
-      -->
-
-    <key>Authentication</key>
-    <dict>
-
-      <!-- Clear text; best avoided -->
-      <key>Basic</key>
-      <dict>
-        <key>Enabled</key>
-        <true/>
-        <key>AllowedOverWireUnencrypted</key> <!-- advertised over non SSL? -->
-        <true/>
-      </dict>
-
-      <!-- Digest challenge/response -->
-      <key>Digest</key>
-      <dict>
-        <key>Enabled</key>
-        <true/>
-        <key>AllowedOverWireUnencrypted</key> <!-- advertised over non SSL? -->
-        <true/>
-        <key>Algorithm</key>
-        <string>md5</string>
-        <key>Qop</key>
-        <string></string>
-      </dict>
-
-      <!-- Kerberos/SPNEGO -->
-      <key>Kerberos</key>
-      <dict>
-        <key>Enabled</key>
-        <true/>
-        <key>AllowedOverWireUnencrypted</key> <!-- advertised over non SSL? -->
-        <true/>
-        <key>ServicePrincipal</key>
-        <string></string>
-      </dict>
-
-      <!-- Wikiserver authentication (Mac OS X) -->
-      <key>Wiki</key>
-      <dict>
-        <key>Enabled</key>
-        <true/>
-        <key>Cookie</key>
-        <string>sessionID</string>
-        <key>URL</key>
-        <string>http://127.0.0.1/RPC2</string>
-        <key>UserMethod</key>
-        <string>userForSession</string>
-        <key>WikiMethod</key>
-        <string>accessLevelForUserWikiCalendar</string>
-      </dict>
-
-    </dict>
-
-
-    <!--
-        Logging
-      -->
-
-    <!-- Log root -->
-    <key>LogRoot</key>
-    <string>Logs</string>
-
-    <!-- Apache-style access log -->
-    <key>AccessLogFile</key>
-    <string>access.log</string>
-    <key>RotateAccessLog</key>
-    <false/>
-
-    <!-- Server activity log -->
-    <key>ErrorLogFile</key>
-    <string>error.log</string>
-
-    <!-- Log levels -->
-    <key>DefaultLogLevel</key>
-    <string>info</string> <!-- debug, info, warn, error -->
-
-    <!-- Log level overrides for specific functionality -->
-    <key>LogLevels</key>
-    <dict>
-      <!--
-      <key>twistedcaldav.directory.appleopendirectory.OpenDirectoryService</key>
-      <string>debug</string>
-      -->
-    </dict>
-
-    <!-- Server process ID file -->
-    <key>PIDFile</key>
-    <string>caldavd.pid</string>
-
-
-    <!--
-        Accounting
-      -->
-
-    <!-- Enable accounting for certain operations -->
-    <key>AccountingCategories</key>
-    <dict>
-      <key>iTIP</key>
-      <false/>
-      <key>HTTP</key>
-      <false/>
-    </dict>
-
-    <!-- Enable accounting for specific principals -->
-    <key>AccountingPrincipals</key>
-    <array>
-      <!-- <string>/principals/__uids__/454D85C0-09F0-4DC6-A3C6-97DFEB4622CD/</string> -->
-    </array>
-
-
-    <!--
-        SSL/TLS
-      -->
-
-    <!-- Public key -->
-    <key>SSLCertificate</key>
-    <string>twistedcaldav/test/data/server.pem</string>
-
-    <!-- SSL authority chain (for intermediate certs) -->
-    <key>SSLAuthorityChain</key>
-    <string></string>
-
-    <!-- Private key -->
-    <key>SSLPrivateKey</key>
-    <string>twistedcaldav/test/data/server.pem</string>
-
-
-    <!--
-        Process management
-      -->
-
-    <key>UserName</key>
-    <string></string>
-
-    <key>GroupName</key>
-    <string></string>
-
-    <key>ProcessType</key>
-    <string>Combined</string>
-
-    <key>MultiProcess</key>
-    <dict>
-      <key>ProcessCount</key>
-      <integer>2</integer> <!-- 0 = automatic -->
-    </dict>
-
-
-    <!--
-        Notifications
-      -->
-
-    <key>Notifications</key>
-    <dict>
-      <!-- Time spent coalescing notifications before delivery -->
-      <key>CoalesceSeconds</key>
-      <integer>3</integer>
-
-      <key>Services</key>
-      <dict>
-
-        <key>AMP</key>
-        <dict>
-          <key>Enabled</key>
-          <false/>
-          <key>Port</key>
-          <integer>62311</integer>
-          <key>EnableStaggering</key>
-          <false/>
-          <key>StaggerSeconds</key>
-          <integer>3</integer>
-        </dict>
-
-      </dict>
-    </dict>
-
-
-    <!--
-        Server-to-server protocol
-      -->
-
-    <key>Scheduling</key>
-    <dict>
-
-      <!-- CalDAV protocol options -->
-      <key>CalDAV</key>
-      <dict>
-        <key>EmailDomain</key>
-        <string></string>
-        <key>HTTPDomain</key>
-        <string></string>
-        <key>AddressPatterns</key>
-        <array>
-        </array>
-        <key>OldDraftCompatibility</key>
-        <true/>
-        <key>ScheduleTagCompatibility</key>
-        <true/>
-        <key>EnablePrivateComments</key>
-        <true/>
-      </dict>
-
-      <!-- iSchedule protocol options -->
-      <key>iSchedule</key>
-      <dict>
-        <key>Enabled</key>
-        <false/>
-        <key>AddressPatterns</key>
-        <array>
-        </array>
-        <key>RemoteServers</key>
-        <string>remoteservers-test.xml</string>
-      </dict>
-
-      <!-- iMIP protocol options -->
-      <key>iMIP</key>
-      <dict>
-        <key>Enabled</key>
-        <false/>
-        <key>MailGatewayServer</key>
-        <string>localhost</string>
-        <key>MailGatewayPort</key>
-        <integer>62310</integer>
-        <key>Sending</key>
-        <dict>
-          <key>Server</key>
-          <string></string>
-          <key>Port</key>
-          <integer>587</integer>
-          <key>UseSSL</key>
-          <true/>
-          <key>Username</key>
-          <string></string>
-          <key>Password</key>
-          <string></string>
-          <key>Address</key>
-          <string></string> <!-- Address email will be sent from -->
-          <key>SupressionDays</key>
-          <integer>7</integer> <!-- Don't send messages for events earlier than this many days in the past -->
-        </dict>
-        <key>Receiving</key>
-        <dict>
-          <key>Server</key>
-          <string></string>
-          <key>Port</key>
-          <integer>995</integer>
-          <key>Type</key>
-          <string></string> <!-- Either "pop" or "imap" -->
-          <key>UseSSL</key>
-          <true/>
-          <key>Username</key>
-          <string></string>
-          <key>Password</key>
-          <string></string>
-          <key>PollingSeconds</key>
-          <integer>30</integer>
-        </dict>
-        <key>AddressPatterns</key>
-        <array>
-          <string>mailto:.*</string>
-        </array>
-      </dict>
-
-      <!-- General options for scheduling -->
-      <key>Options</key>
-      <dict>
-        <key>AllowGroupAsOrganizer</key>
-        <false/>
-        <key>AllowLocationAsOrganizer</key>
-        <false/>
-        <key>AllowResourceAsOrganizer</key>
-        <false/>
-        <key>AttendeeRefreshBatch</key>
-        <integer>0</integer>
-
-		<key>AutoSchedule</key>
-		<dict>
-			<key>Enabled</key>
-			<true/>
-			<key>Always</key>
-			<false/>
-			<!-- Default mode for auto-schedule processing, one of:
-	              "none"            - no auto-scheduling
-	              "accept-always"   - always accept, ignore busy time
-	              "decline-always"  - always decline, ignore free time
-	              "accept-if-free"  - accept if free, do nothing if busy
-	              "decline-if-busy" - decline if busy, do nothing if free
-	              "automatic"       - accept if free, decline if busy -->
-	        <key>DefaultMode</key>
-	        <string>automatic</string>
-		</dict>
-      </dict>
-    </dict>
-
-
-    <!--
-        Free-busy URL protocol
-      -->
-
-    <key>FreeBusyURL</key>
-    <dict>
-      <key>Enabled</key>
-      <true/>
-      <key>TimePeriod</key>
-      <integer>14</integer>
-      <key>AnonymousAccess</key>
-      <false/>
-    </dict>
-
-
-    <!--
-        Non-standard CalDAV extensions
-      -->
-
-    <!-- Calendar Drop Box -->
-    <key>EnableDropBox</key>
-    <false/>
-
-    <!-- Calendar Managed Attachments -->
-    <key>EnableManagedAttachments</key>
-    <true/>
-
-    <!-- Private Events -->
-    <key>EnablePrivateEvents</key>
-    <true/>
-
-    <!-- Timezone Service -->
-    <key>EnableTimezoneService</key>
-    <true/>
-
-    <!-- Standard Timezone Service -->
-    <key>TimezoneService</key>
-    <dict>
-    	<key>Enabled</key>
-    	<true/>
-    	<key>Mode</key>
-    	<string>primary</string>
-    	<key>BasePath</key>
-    	<string></string>
-    	<key>XMLInfoPath</key>
-    	<string></string>
-    	<key>SecondaryService</key>
-    	<dict>
-    		<key>Host</key>
-    		<string></string>
-    		<key>URI</key>
-    		<string></string>
-    		<key>UpdateIntervalMinutes</key>
-    		<integer>1440</integer>
-    	</dict>
-    </dict>
-
-	<key>UsePackageTimezones</key>
-	<true/>
-
-    <!-- Batch Upload via POST -->
-    <key>EnableBatchUpload</key>
-    <true/>
-
-    <!-- Shared Calendars & Address Books -->
-    <key>Sharing</key>
-    <dict>
-      <key>Enabled</key>
-      <true/>
-      <key>AllowExternalUsers</key>
-      <false/>
-      <key>Calendars</key>
-      <dict>
-    	<key>Enabled</key>
-    	<true/>
-      </dict>
-      <key>AddressBooks</key>
-      <dict>
-    	<key>Enabled</key>
-    	<true/>
-      </dict>
-    </dict>
-
-    <!--
-        Miscellaneous items
-      -->
-
-    <!-- Service ACLs (Mac OS X) -->
-    <key>EnableSACLs</key>
-    <false/>
-
-    <!-- Make entire server read-only -->
-    <key>EnableReadOnlyServer</key>
-    <false/>
-
-    <!-- Web-based administration -->
-    <key>EnableWebAdmin</key>
-    <true/>
-
-    <!-- Support for Content-Encoding compression options as specified in RFC2616 Section 3.5 -->
-    <key>ResponseCompression</key>
-    <false/>
-    
-    <!-- The retry-after value (in seconds) to return with a 503 error. -->
-    <key>HTTPRetryAfter</key>
-    <integer>180</integer>
-
-    <!-- For child-master IPC. [empty = use tcp] -->
-    <key>ControlSocket</key>
-    <string>caldavd.sock</string>
-
-    <!-- Support for Memcached -->
-    <key>Memcached</key>
-    <dict>
-      <key>MaxClients</key>
-      <integer>5</integer>
-      <key>memcached</key>
-      <string>memcached</string> <!-- Find in PATH -->
-      <key>Options</key>
-      <array>
-        <!--<string>-vv</string>--> <!-- Be very verbose -->
-      </array>
-    </dict>
-
-    <!-- Response Caching -->
-    <key>EnableResponseCache</key>
-    <true/>
-    <key>ResponseCacheTimeout</key>
-    <integer>30</integer> <!-- in minutes -->
-
-    <!-- Support for Postgres -->
-    <key>Postgres</key>
-    <dict>
-      <key>Options</key>
-      <array>
-      	<!-- Optional extra logging for posgres -->
-      	<!-- <string>-c log_lock_waits=TRUE</string> -->
-      	<!-- <string>-c log_statement=all</string> -->
-      	<!-- <string>-c log_line_prefix='%t [%p]: [%l] '</string> -->
-      </array>
-    </dict>
-
-    <!-- SQL Query Caching -->
-    <key>QueryCaching</key>
-    <dict>
-      <key>Enabled</key>
-      <true/>
-      <key>MemcachedPool</key>
-      <string>Default</string>
-      <key>ExpireSeconds</key>
-      <integer>3600</integer>
-    </dict>
-
-    <!-- Group Membership Caching -->
-    <key>GroupCaching</key>
-    <dict>
-      <key>Enabled</key>
-      <true/>
-      <key>EnableUpdater</key>
-      <true/>
-      <key>MemcachedPool</key>
-      <string>Default</string>
-      <key>UpdateSeconds</key>
-      <integer>300</integer>
-      <key>ExpireSeconds</key>
-      <integer>3600</integer>
-      <key>LockSeconds</key>
-      <integer>300</integer>
-      <key>UseExternalProxies</key>
-      <false/>
-    </dict>
-
-    <!-- Maximum number of results returned by principal-property-search REPORT -->
-    <key>MaxPrincipalSearchReportResults</key>
-    <integer>500</integer>
-
-    <!--
-        Twisted
-      -->
-
-    <key>Twisted</key>
-    <dict>
-      <key>twistd</key>
-      <string>../Twisted/bin/twistd</string>
-    </dict>
-
-
-    <key>Localization</key>
-    <dict>
-      <key>TranslationsDirectory</key>
-      <string>locales</string>
-      <key>LocalesDirectory</key>
-      <string>locales</string>
-      <key>Language</key>
-      <string>en</string>
-    </dict>
-
-    <!--
-        Directory Address Book
-      -->
-    
-    <!--  Disable Directory Address Book -->
-    <!--
-      <key>DirectoryAddressBook</key>
-      <false/>
-    -->
-    
-    <!-- LDAP-backed Directory Address Book -->
-    <key>EnableSearchAddressBook</key>
-    <true/>
-    <key>DirectoryAddressBook</key>
-    <dict>
-        <key>Enabled</key>
-        <true/>
- 		<key>type</key>
-		<string>twistedcaldav.directory.ldapdirectorybacker.LdapDirectoryBackingService</string>
-		<key>params</key>
-		<dict>
-			<key>warningThresholdSeconds</key>
-			<integer>1</integer>
-			<key>appleInternalServer</key>
-			<true/>
-            <!-- fake uri, fill in.  -->
-			<key>uri</key>
-			<string>ldap://example.com/</string>
-            <!-- fill in auth info, if needed.  -->
-			<key>tls</key>
-			<false/>
-			<key>tlsCACertFile</key>
-			<string></string>
-			<key>tlsCACertDir</key>
-			<string></string>
-			<key>tlsRequireCert</key>
-			<string>never</string>
-			<key>credentials</key>
-			<dict/>
-			<key>authMethod</key>
-			<string>LDAP</string>
-			<key>rdnSchema</key>
-			<dict>
-				<key>base</key>
-				<string>o=apple</string>
-                <key>queries</key>
-                <array>
-                    <!-- user vCards  -->
-    				<dict>
-                        <key>rdn</key>
-                        <string>ou=people</string>
-                        <key>filter</key>
-                        <string></string>
-                        <!-- map from ab query to indexed ldap attribute.  If unindexed, too slow.  -->
-                        <key>vcardPropToLdapAttrMap</key>
-                        <dict>
-                            <key>FN</key>       <string>cn</string>
-                            <key>EMAIL</key>    <string>mail</string>
-                            <key>TEL</key>      <string>telephoneNumber</string>
-                            <key>ADR</key>
-                            <array>
-                                <string>buildingName</string>
-                                <string>destinationIndicator</string>
-                                <string>street</string>
-                                <string>l</string>
-                                <string>st</string>
-                            </array>
-                            <key>ORG</key>  <string>ou</string>
-                            <key>UID</key>  <string>appleDSID</string>
-                        </dict>
-                        <!-- map ldap attributes to ds attribute types.  -->
-    					<key>ldapAttrToDSAttrMap</key>
-    					<dict>
-    						<key>givenName</key>    <string>FirstName</string>
-    						<key>sn</key>           <string>LastName</string>
-    						<key>cn</key>           <string>RealName</string>
-                            <!-- PHOTO  -->
-    						<key>applePhotoPreferred-jpeg</key>    <string>JPEGPhoto</string>
-                            <!-- ADR  -->
-    						<key>buildingName</key>         <string>Building</string>
-    						<key>destinationIndicator</key> <string>Building</string>
-    						<key>street</key>               <string>Street</string>
-    						<key>l</key>                    <string>City</string>
-    						<key>st</key>                   <string>State</string>
-    						<key>postalCode</key>           <string>PostalCode</string>
-    						<key>co</key>                   <string>Country</string>
-                            <!-- TEL  -->
-   						    <key>telephoneNumber</key>          <string>PhoneNumber</string>
-    						<key>appleSecondaryPhone</key>      <string>PhoneNumber</string>
-    						<key>facsimileTelephoneNumber</key> <string>FaxNumber</string>
-    						<key>pager</key>                    <string>PagerNumber</string>
-    						<key>mobile</key>                   <string>MobileNumber</string>
-                            <!-- EMAIL  -->
-    						<key>mail</key>                     <string>EMailAddress</string>
-    						<key>applePreferredEmail</key>      <string>EMailAddress</string>
-    						<key>appleNotificationEmail</key>   <string>EMailAddress</string>
-                            <!-- UID  -->
-    						<key>appleDSID</key>    <string>GeneratedUID</string>
-                            <!-- ORG  -->
-    						<key>o</key>            <string>OrganizationName</string>
-    						<key>ou</key>           <string>Department</string>
-                            <!-- IMPP  -->
-    						<key>appleAIMPreferred</key>    <string>IMHandle</string>
-    						<key>appleAIMOfficial</key>     <string>IMHandle</string>
-    						<key>appleManager</key>         <string>dsAttrTypeNative:appleManager</string>
-    					</dict>
-    				</dict>
-                    <!-- mailing list vCards.  Should mark as company-->
-    				<dict>
-    					<key>rdn</key>                  <string>ou=groups</string>
-    					<key>kind</key>                  <string>org</string>
-    					<key>filter</key>               <string>(objectClass=appleGroup)</string>
-    					<key>getAllAttributes</key>     <false/>
-    					<key>vcardPropToLdapAttrMap</key>
-    					<dict>
-    						<key>EMAIL</key>    <string>appleGroupEmail</string>
-    						<key>FN</key>       <string>description</string>
-    						<key>UID</key>      <string>appleDSID</string>
-    					</dict>
-    					<key>ldapAttrToDSAttrMap</key>
-    					<dict>
-    						<key>cn</key>    <string>RecordName</string>
-    						<key>description</key>
-    						<array>
-    							<string>RealName</string>
-    							<string>OrganizationName</string>
-    						</array>
-    						<key>appleDSID</key>            <string>GeneratedUID</string>
-    						<key>appleGroupContact</key>    <string>dsAttrTypeNative:appleManager</string>
-    						<key>appleGroupEmail</key>      <string>EMailAddress</string>
-    					</dict>
-                    </dict>
-                </array>
-			</dict>
-		</dict>
-   </dict>
-  </dict>
-</plist>

Deleted: CalendarServer/branches/users/gaya/xmldirectorybacker/conf/carddav-ldaptest2.plist
===================================================================
--- CalendarServer/branches/users/gaya/xmldirectorybacker/conf/carddav-ldaptest2.plist	2013-10-10 18:51:46 UTC (rev 11803)
+++ CalendarServer/branches/users/gaya/xmldirectorybacker/conf/carddav-ldaptest2.plist	2013-10-10 19:02:50 UTC (rev 11804)
@@ -1,1165 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
-    Copyright (c) 2006-2013 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 plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-  <dict>
-
-    <!--
-        Public network address information
-
-        This is the server's public network address, which is provided to
-        clients in URLs and the like.  It may or may not be the network
-        address that the server is listening to directly, though it is by
-        default.  For example, it may be the address of a load balancer or
-        proxy which forwards connections to the server.
-      -->
-
-    <!-- Network host name [empty = system host name] -->
-    <key>ServerHostName</key>
-    <string>localhost</string> <!-- The hostname clients use when connecting -->
-
-    <!-- Enable Calendars -->
-    <key>EnableCalDAV</key>
-    <true/>
-
-    <!-- Enable AddressBooks -->
-    <key>EnableCardDAV</key>
-    <true/>
-
-    <!-- HTTP port [0 = disable HTTP] -->
-    <key>HTTPPort</key>
-    <integer>8008</integer>
-
-    <!-- SSL port [0 = disable HTTPS] -->
-    <!-- (Must also configure SSLCertificate and SSLPrivateKey below) -->
-    <key>SSLPort</key>
-    <integer>8443</integer>
-
-    <!-- Enable listening on SSL port(s) -->
-    <key>EnableSSL</key>
-    <true/>
-
-    <!-- Redirect non-SSL ports to an SSL port (if configured for SSL) -->
-    <key>RedirectHTTPToHTTPS</key>
-    <false/>
-
-
-    <!--
-        Network address configuration information
-
-        This configures the actual network address that the server binds to.
-      -->
-
-    <!-- List of IP addresses to bind to [empty = all] -->
-    <key>BindAddresses</key>
-    <array>
-    </array>
-
-    <!-- List of port numbers to bind to for HTTP [empty = same as "Port"] -->
-    <key>BindHTTPPorts</key>
-    <array>
-        <integer>8008</integer>
-        <integer>8800</integer>
-    </array>
-
-    <!-- List of port numbers to bind to for SSL [empty = same as "SSLPort"] -->
-    <key>BindSSLPorts</key>
-    <array>
-        <integer>8443</integer>
-        <integer>8843</integer>
-    </array>
-
-
-    <!--
-        Data Store
-      -->
-
-    <!-- Server root -->
-    <key>ServerRoot</key>
-    <string>./data</string>
-
-    <!-- Database connection -->
-    <!--
-    <key>DBType</key>
-    <string>postgres</string>
-    <key>DSN</key>
-    <string>:caldav:caldav:::</string>
-     -->
-
-    <!-- Data root -->
-    <key>DataRoot</key>
-    <string>Data</string>
-
-    <!-- Database root -->
-    <key>DatabaseRoot</key>
-    <string>Database</string>
-
-    <!-- Document root -->
-    <key>DocumentRoot</key>
-    <string>Documents</string>
-
-    <!-- Configuration root -->
-    <key>ConfigRoot</key>
-    <string>./conf</string>
-
-    <!-- Run root -->
-    <key>RunRoot</key>
-    <string>Logs/state</string>
-
-    <!-- Child aliases -->
-    <key>Aliases</key>
-    <array>
-      <!--
-      <dict>
-        <key>url</key>
-        <string>/foo</string>
-        <key>path</key>
-        <string>/path/to/foo</string>
-      </dict>
-       -->
-    </array>
-
-
-    <!--
-        Quotas and limits
-      -->
-
-    <!-- User quota (in bytes) [0 = no quota] applies to attachments only -->
-    <key>UserQuota</key>
-    <integer>104857600</integer><!-- 100Mb -->
-
-    <!-- Maximum number of calendars/address books allowed in a home -->
-    <!-- 0 for no limit -->
-    <key>MaxCollectionsPerHome</key>
-    <integer>50</integer>
-
-    <!-- Maximum number of resources in a calendar/address book -->
-    <!-- 0 for no limit -->
-    <key>MaxResourcesPerCollection</key>
-    <integer>10000</integer>
-
-    <!-- Maximum resource size (in bytes) -->
-    <key>MaxResourceSize</key>
-    <integer>1048576</integer> <!-- 1Mb -->
-
-    <!-- Maximum number of unique attendees per entire event -->
-    <!-- 0 for no limit -->
-    <key>MaxAttendeesPerInstance</key>
-    <integer>100</integer>
-
-    <!-- Maximum number of instances allowed during expansion -->
-    <!-- 0 for no limit -->
-    <key>MaxAllowedInstances</key>
-    <integer>3000</integer>
-
-    <!--
-        Directory service
-
-        A directory service provides information about principals (eg.
-        users, groups, locations and resources) to the server.
-
-        A variety of directory services are available for use.
-      -->
-
-    <!-- XML File Directory Service -->
-    <key>DirectoryService</key>
-    <dict>
-      <key>type</key>
-      <string>twistedcaldav.directory.xmlfile.XMLDirectoryService</string>
-      
-      <key>params</key>
-      <dict>
-        <key>xmlFile</key>
-        <string>./conf/auth/accounts-test.xml</string>
-      </dict>
-    </dict>
-    
-    <!-- Open Directory Service (Mac OS X) -->
-    <!--
-    <key>DirectoryService</key>
-    <dict>
-      <key>type</key>
-      <string>twistedcaldav.directory.appleopendirectory.OpenDirectoryService</string>
-      
-      <key>params</key>
-      <dict>
-        <key>node</key>
-        <string>/Search</string>
-        <key>cacheTimeout</key>
-        <integer>10</integer>
-      </dict>
-    </dict>
-    -->
-
-    <!--  OpenLDAP Directory Service -->
-    <!--
-    <key>DirectoryService</key>
-    <dict>
-      <key>type</key>
-      <string>twistedcaldav.directory.ldapdirectory.LdapDirectoryService</string>
-
-      <key>params</key>
-      <dict>
-        <key>recordTypes</key>
-        <array>
-           <string>users</string>
-           <string>groups</string>
-           <string>locations</string>
-           <string>resources</string>
-        </array>
-        <key>cacheTimeout</key>
-        <integer>10</integer>
-        <key>uri</key>
-        <string>ldap://ldapserver.example.com/</string>
-        <key>tls</key>
-        <false/>
-        <key>tlsCACertFile</key>
-        <string></string>
-        <key>tlsCACertDir</key>
-        <string></string>
-        <key>tlsRequireCert</key>
-        <string>never</string>
-        <key>credentials</key>
-        <dict>
-          <key>dn</key>
-          <string>uid=admin,ou=people,o=example.com</string>
-          <key>password</key>
-          <string>PASSWORD</string>
-        </dict>
-        <key>rdnSchema</key>
-        <dict>
-          <key>base</key>
-          <string>o=example.com</string>
-          <key>guidAttr</key>
-          <string>GUID</string>
-          <key>users</key>
-          <dict>
-            <key>rdn</key>
-            <string>ou=people</string>
-            <key>mapping</key>
-            <dict>
-                <key>recordName</key>
-                <string>uid</string>
-                <key>fullName</key>
-                <string>cn</string>
-                <key>emailAddresses</key>
-                <array>
-                    <string>mail</string>
-                    <string>mailAlias</string>
-                </array>
-                <key>firstName</key>
-                <string>givenName</string>
-                <key>lastName</key>
-                <string>sn</string>
-            </dict>
-          </dict>
-          <key>groups</key>
-          <dict>
-            <key>rdn</key>
-            <string>ou=groups</string>
-            <key>mapping</key>
-            <dict>
-                <key>recordName</key>
-                <string>cn</string>
-                <key>fullName</key>
-                <string>cn</string>
-                <key>emailAddresses</key>
-                <array>
-                    <string>mail</string>
-                    <string>mailAlias</string>
-                </array>
-                <key>firstName</key>
-                <string></string>
-                <key>lastName</key>
-                <string></string>
-            </dict>
-          </dict>
-          <key>locations</key>
-          <dict>
-            <key>rdn</key>
-            <string>ou=locations</string>
-            <key>mapping</key>
-            <dict>
-                <key>recordName</key>
-                <string>cn</string>
-                <key>fullName</key>
-                <string>cn</string>
-                <key>emailAddresses</key>
-                <array>
-                </array>
-                <key>firstName</key>
-                <string></string>
-                <key>lastName</key>
-                <string></string>
-            </dict>
-          </dict>
-          <key>resources</key>
-          <dict>
-            <key>rdn</key>
-            <string>ou=resources</string>
-            <key>mapping</key>
-            <dict>
-                <key>recordName</key>
-                <string>cn</string>
-                <key>fullName</key>
-                <string>cn</string>
-                <key>emailAddresses</key>
-                <array>
-                </array>
-                <key>firstName</key>
-                <string></string>
-                <key>lastName</key>
-                <string></string>
-            </dict>
-          </dict>
-        </dict>
-        <key>groupSchema</key>
-        <dict>
-          <key>membersAttr</key>
-          <string>uniqueMember</string>
-          <key>nestedGroupsAttr</key>
-          <string></string>
-          <key>memberIdAttr</key>
-          <string></string>
-        </dict>
-        <key>resourceSchema</key>
-        <dict>
-         <key>resourceInfoAttr</key>
-         <string></string>
-         <key>autoScheduleAttr</key>
-         <string></string>
-         <key>autoScheduleEnabledValue</key>
-         <string></string>
-         <key>proxyAttr</key>
-         <string></string>
-         <key>readOnlyProxyAttr</key>
-         <string></string>
-        </dict>
-      </dict>
-    </dict>
-    -->
-
-    <!-- Resource and Location Service -->
-    <key>ResourceService</key>
-    <dict>
-      <key>Enabled</key>
-      <true/>
-      <key>type</key>
-      <string>twistedcaldav.directory.xmlfile.XMLDirectoryService</string>
-      
-      <key>params</key>
-      <dict>
-        <key>xmlFile</key>
-        <string>./conf/auth/resources-test.xml</string>
-      </dict>
-    </dict>
-
-    <!-- XML File Augment Service -->
-    <key>AugmentService</key>
-    <dict>
-      <key>type</key>
-      <string>twistedcaldav.directory.augment.AugmentXMLDB</string>
-      
-      <key>params</key>
-      <dict>
-        <key>xmlFiles</key>
-        <array>
-	      <string>./conf/auth/augments-test.xml</string>
-        </array>
-      </dict>
-    </dict>
-
-    <!-- Sqlite Augment Service -->
-    <!--
-    <key>AugmentService</key>
-    <dict>
-      <key>type</key>
-      <string>twistedcaldav.directory.augment.AugmentSqliteDB</string>
-      
-      <key>params</key>
-      <dict>
-        <key>dbpath</key>
-        <string>./conf/auth/augments.sqlite</string>
-      </dict>
-    </dict>
-     -->
-
-    <!-- PostgreSQL Augment Service -->
-    <!--
-    <key>AugmentService</key>
-    <dict>
-      <key>type</key>
-      <string>twistedcaldav.directory.augment.AugmentPostgreSQLDB</string>
-      
-      <key>params</key>
-      <dict>
-        <key>host</key>
-        <string>localhost</string>
-        <key>database</key>
-        <string>augments</string>
-      </dict>
-    </dict>
-     -->
-
-    <!-- Sqlite ProxyDB Service -->
-    <key>ProxyDBService</key>
-    <dict>
-      <key>type</key>
-      <string>twistedcaldav.directory.calendaruserproxy.ProxySqliteDB</string>
-      
-      <key>params</key>
-      <dict>
-        <key>dbpath</key>
-        <string>proxies.sqlite</string>
-      </dict>
-    </dict>
-
-    <!-- PostgreSQL ProxyDB Service -->
-    <!--
-    <key>ProxyDBService</key>
-    <dict>
-      <key>type</key>
-      <string>twistedcaldav.directory.calendaruserproxy.ProxyPostgreSQLDB</string>
-      
-      <key>params</key>
-      <dict>
-        <key>host</key>
-        <string>localhost</string>
-        <key>database</key>
-        <string>proxies</string>
-      </dict>
-    </dict>
-     -->
-
-    <key>ProxyLoadFromFile</key>
-    <string>./conf/auth/proxies-test.xml</string>
-
-
-    <!--
-        Special principals
-
-        These principals are granted special access and/or perform
-        special roles on the server.
-      -->
-
-    <!-- Principals with "DAV:all" access (relative URLs) -->
-    <key>AdminPrincipals</key>
-    <array>
-      <string>/principals/__uids__/admin/</string>
-    </array>
-
-    <!-- Principals with "DAV:read" access (relative URLs) -->
-    <key>ReadPrincipals</key>
-    <array>
-      <!-- <string>/principals/__uids__/983C8238-FB6B-4D92-9242-89C0A39E5F81/</string> -->
-    </array>
-
-    <!-- Create "proxy access" principals -->
-    <key>EnableProxyPrincipals</key>
-    <true/>
-
-
-    <!--
-        Permissions
-      -->
-
-    <!-- Anonymous read access for root resource -->
-    <key>EnableAnonymousReadRoot</key>
-    <true/>
-
-    <!-- Anonymous read access for resource hierarchy -->
-    <key>EnableAnonymousReadNav</key>
-    <false/>
-
-    <!-- Enables directory listings for principals -->
-    <key>EnablePrincipalListings</key>
-    <true/>
-
-    <!-- Render calendar collections as a monolithic iCalendar object -->
-    <key>EnableMonolithicCalendars</key>
-    <true/>
-
-
-    <!--
-        Authentication
-      -->
-
-    <key>Authentication</key>
-    <dict>
-
-      <!-- Clear text; best avoided -->
-      <key>Basic</key>
-      <dict>
-        <key>Enabled</key>
-        <true/>
-        <key>AllowedOverWireUnencrypted</key> <!-- advertised over non SSL? -->
-        <true/>
-      </dict>
-
-      <!-- Digest challenge/response -->
-      <key>Digest</key>
-      <dict>
-        <key>Enabled</key>
-        <true/>
-        <key>AllowedOverWireUnencrypted</key> <!-- advertised over non SSL? -->
-        <true/>
-        <key>Algorithm</key>
-        <string>md5</string>
-        <key>Qop</key>
-        <string></string>
-      </dict>
-
-      <!-- Kerberos/SPNEGO -->
-      <key>Kerberos</key>
-      <dict>
-        <key>Enabled</key>
-        <true/>
-        <key>AllowedOverWireUnencrypted</key> <!-- advertised over non SSL? -->
-        <true/>
-        <key>ServicePrincipal</key>
-        <string></string>
-      </dict>
-
-      <!-- Wikiserver authentication (Mac OS X) -->
-      <key>Wiki</key>
-      <dict>
-        <key>Enabled</key>
-        <true/>
-        <key>Cookie</key>
-        <string>sessionID</string>
-        <key>URL</key>
-        <string>http://127.0.0.1/RPC2</string>
-        <key>UserMethod</key>
-        <string>userForSession</string>
-        <key>WikiMethod</key>
-        <string>accessLevelForUserWikiCalendar</string>
-      </dict>
-
-    </dict>
-
-
-    <!--
-        Logging
-      -->
-
-    <!-- Log root -->
-    <key>LogRoot</key>
-    <string>Logs</string>
-
-    <!-- Apache-style access log -->
-    <key>AccessLogFile</key>
-    <string>access.log</string>
-    <key>RotateAccessLog</key>
-    <false/>
-
-    <!-- Server activity log -->
-    <key>ErrorLogFile</key>
-    <string>error.log</string>
-
-    <!-- Log levels -->
-    <key>DefaultLogLevel</key>
-    <string>info</string> <!-- debug, info, warn, error -->
-
-    <!-- Log level overrides for specific functionality -->
-    <key>LogLevels</key>
-    <dict>
-      <!--
-      <key>twistedcaldav.directory.appleopendirectory.OpenDirectoryService</key>
-      <string>debug</string>
-      -->
-    </dict>
-
-    <!-- Server process ID file -->
-    <key>PIDFile</key>
-    <string>caldavd.pid</string>
-
-
-    <!--
-        Accounting
-      -->
-
-    <!-- Enable accounting for certain operations -->
-    <key>AccountingCategories</key>
-    <dict>
-      <key>iTIP</key>
-      <false/>
-      <key>HTTP</key>
-      <false/>
-    </dict>
-
-    <!-- Enable accounting for specific principals -->
-    <key>AccountingPrincipals</key>
-    <array>
-      <!-- <string>/principals/__uids__/454D85C0-09F0-4DC6-A3C6-97DFEB4622CD/</string> -->
-    </array>
-
-
-    <!--
-        SSL/TLS
-      -->
-
-    <!-- Public key -->
-    <key>SSLCertificate</key>
-    <string>twistedcaldav/test/data/server.pem</string>
-
-    <!-- SSL authority chain (for intermediate certs) -->
-    <key>SSLAuthorityChain</key>
-    <string></string>
-
-    <!-- Private key -->
-    <key>SSLPrivateKey</key>
-    <string>twistedcaldav/test/data/server.pem</string>
-
-
-    <!--
-        Process management
-      -->
-
-    <key>UserName</key>
-    <string></string>
-
-    <key>GroupName</key>
-    <string></string>
-
-    <key>ProcessType</key>
-    <string>Combined</string>
-
-    <key>MultiProcess</key>
-    <dict>
-      <key>ProcessCount</key>
-      <integer>2</integer> <!-- 0 = automatic -->
-    </dict>
-
-
-    <!--
-        Notifications
-      -->
-
-    <key>Notifications</key>
-    <dict>
-      <!-- Time spent coalescing notifications before delivery -->
-      <key>CoalesceSeconds</key>
-      <integer>3</integer>
-
-      <key>Services</key>
-      <dict>
-
-        <key>AMP</key>
-        <dict>
-          <key>Enabled</key>
-          <false/>
-          <key>Port</key>
-          <integer>62311</integer>
-          <key>EnableStaggering</key>
-          <false/>
-          <key>StaggerSeconds</key>
-          <integer>3</integer>
-        </dict>
-
-      </dict>
-    </dict>
-
-
-    <!--
-        Server-to-server protocol
-      -->
-
-    <key>Scheduling</key>
-    <dict>
-
-      <!-- CalDAV protocol options -->
-      <key>CalDAV</key>
-      <dict>
-        <key>EmailDomain</key>
-        <string></string>
-        <key>HTTPDomain</key>
-        <string></string>
-        <key>AddressPatterns</key>
-        <array>
-        </array>
-        <key>OldDraftCompatibility</key>
-        <true/>
-        <key>ScheduleTagCompatibility</key>
-        <true/>
-        <key>EnablePrivateComments</key>
-        <true/>
-      </dict>
-
-      <!-- iSchedule protocol options -->
-      <key>iSchedule</key>
-      <dict>
-        <key>Enabled</key>
-        <false/>
-        <key>AddressPatterns</key>
-        <array>
-        </array>
-        <key>RemoteServers</key>
-        <string>remoteservers-test.xml</string>
-      </dict>
-
-      <!-- iMIP protocol options -->
-      <key>iMIP</key>
-      <dict>
-        <key>Enabled</key>
-        <false/>
-        <key>MailGatewayServer</key>
-        <string>localhost</string>
-        <key>MailGatewayPort</key>
-        <integer>62310</integer>
-        <key>Sending</key>
-        <dict>
-          <key>Server</key>
-          <string></string>
-          <key>Port</key>
-          <integer>587</integer>
-          <key>UseSSL</key>
-          <true/>
-          <key>Username</key>
-          <string></string>
-          <key>Password</key>
-          <string></string>
-          <key>Address</key>
-          <string></string> <!-- Address email will be sent from -->
-          <key>SupressionDays</key>
-          <integer>7</integer> <!-- Don't send messages for events earlier than this many days in the past -->
-        </dict>
-        <key>Receiving</key>
-        <dict>
-          <key>Server</key>
-          <string></string>
-          <key>Port</key>
-          <integer>995</integer>
-          <key>Type</key>
-          <string></string> <!-- Either "pop" or "imap" -->
-          <key>UseSSL</key>
-          <true/>
-          <key>Username</key>
-          <string></string>
-          <key>Password</key>
-          <string></string>
-          <key>PollingSeconds</key>
-          <integer>30</integer>
-        </dict>
-        <key>AddressPatterns</key>
-        <array>
-          <string>mailto:.*</string>
-        </array>
-      </dict>
-
-      <!-- General options for scheduling -->
-      <key>Options</key>
-      <dict>
-        <key>AllowGroupAsOrganizer</key>
-        <false/>
-        <key>AllowLocationAsOrganizer</key>
-        <false/>
-        <key>AllowResourceAsOrganizer</key>
-        <false/>
-        <key>AttendeeRefreshBatch</key>
-        <integer>0</integer>
-
-		<key>AutoSchedule</key>
-		<dict>
-			<key>Enabled</key>
-			<true/>
-			<key>Always</key>
-			<false/>
-			<!-- Default mode for auto-schedule processing, one of:
-	              "none"            - no auto-scheduling
-	              "accept-always"   - always accept, ignore busy time
-	              "decline-always"  - always decline, ignore free time
-	              "accept-if-free"  - accept if free, do nothing if busy
-	              "decline-if-busy" - decline if busy, do nothing if free
-	              "automatic"       - accept if free, decline if busy -->
-	        <key>DefaultMode</key>
-	        <string>automatic</string>
-		</dict>
-      </dict>
-    </dict>
-
-
-    <!--
-        Free-busy URL protocol
-      -->
-
-    <key>FreeBusyURL</key>
-    <dict>
-      <key>Enabled</key>
-      <true/>
-      <key>TimePeriod</key>
-      <integer>14</integer>
-      <key>AnonymousAccess</key>
-      <false/>
-    </dict>
-
-
-    <!--
-        Non-standard CalDAV extensions
-      -->
-
-    <!-- Calendar Drop Box -->
-    <key>EnableDropBox</key>
-    <false/>
-
-    <!-- Calendar Managed Attachments -->
-    <key>EnableManagedAttachments</key>
-    <true/>
-
-    <!-- Private Events -->
-    <key>EnablePrivateEvents</key>
-    <true/>
-
-    <!-- Timezone Service -->
-    <key>EnableTimezoneService</key>
-    <true/>
-
-    <!-- Standard Timezone Service -->
-    <key>TimezoneService</key>
-    <dict>
-    	<key>Enabled</key>
-    	<true/>
-    	<key>Mode</key>
-    	<string>primary</string>
-    	<key>BasePath</key>
-    	<string></string>
-    	<key>XMLInfoPath</key>
-    	<string></string>
-    	<key>SecondaryService</key>
-    	<dict>
-    		<key>Host</key>
-    		<string></string>
-    		<key>URI</key>
-    		<string></string>
-    		<key>UpdateIntervalMinutes</key>
-    		<integer>1440</integer>
-    	</dict>
-    </dict>
-
-	<key>UsePackageTimezones</key>
-	<true/>
-
-    <!-- Batch Upload via POST -->
-    <key>EnableBatchUpload</key>
-    <true/>
-
-    <!-- Shared Calendars & Address Books -->
-    <key>Sharing</key>
-    <dict>
-      <key>Enabled</key>
-      <true/>
-      <key>AllowExternalUsers</key>
-      <false/>
-      <key>Calendars</key>
-      <dict>
-    	<key>Enabled</key>
-    	<true/>
-      </dict>
-      <key>AddressBooks</key>
-      <dict>
-    	<key>Enabled</key>
-    	<true/>
-      </dict>
-    </dict>
-
-    <!--
-        Miscellaneous items
-      -->
-
-    <!-- Service ACLs (Mac OS X) -->
-    <key>EnableSACLs</key>
-    <false/>
-
-    <!-- Make entire server read-only -->
-    <key>EnableReadOnlyServer</key>
-    <false/>
-
-    <!-- Web-based administration -->
-    <key>EnableWebAdmin</key>
-    <true/>
-
-    <!-- Support for Content-Encoding compression options as specified in RFC2616 Section 3.5 -->
-    <key>ResponseCompression</key>
-    <false/>
-    
-    <!-- The retry-after value (in seconds) to return with a 503 error. -->
-    <key>HTTPRetryAfter</key>
-    <integer>180</integer>
-
-    <!-- For child-master IPC. [empty = use tcp] -->
-    <key>ControlSocket</key>
-    <string>caldavd.sock</string>
-
-    <!-- Support for Memcached -->
-    <key>Memcached</key>
-    <dict>
-      <key>MaxClients</key>
-      <integer>5</integer>
-      <key>memcached</key>
-      <string>memcached</string> <!-- Find in PATH -->
-      <key>Options</key>
-      <array>
-        <!--<string>-vv</string>--> <!-- Be very verbose -->
-      </array>
-    </dict>
-
-    <!-- Response Caching -->
-    <key>EnableResponseCache</key>
-    <true/>
-    <key>ResponseCacheTimeout</key>
-    <integer>30</integer> <!-- in minutes -->
-
-    <!-- Support for Postgres -->
-    <key>Postgres</key>
-    <dict>
-      <key>Options</key>
-      <array>
-      	<!-- Optional extra logging for posgres -->
-      	<!-- <string>-c log_lock_waits=TRUE</string> -->
-      	<!-- <string>-c log_statement=all</string> -->
-      	<!-- <string>-c log_line_prefix='%t [%p]: [%l] '</string> -->
-      </array>
-    </dict>
-
-    <!-- SQL Query Caching -->
-    <key>QueryCaching</key>
-    <dict>
-      <key>Enabled</key>
-      <true/>
-      <key>MemcachedPool</key>
-      <string>Default</string>
-      <key>ExpireSeconds</key>
-      <integer>3600</integer>
-    </dict>
-
-    <!-- Group Membership Caching -->
-    <key>GroupCaching</key>
-    <dict>
-      <key>Enabled</key>
-      <true/>
-      <key>EnableUpdater</key>
-      <true/>
-      <key>MemcachedPool</key>
-      <string>Default</string>
-      <key>UpdateSeconds</key>
-      <integer>300</integer>
-      <key>ExpireSeconds</key>
-      <integer>3600</integer>
-      <key>LockSeconds</key>
-      <integer>300</integer>
-      <key>UseExternalProxies</key>
-      <false/>
-    </dict>
-
-    <!-- Maximum number of results returned by principal-property-search REPORT -->
-    <key>MaxPrincipalSearchReportResults</key>
-    <integer>500</integer>
-
-    <!--
-        Twisted
-      -->
-
-    <key>Twisted</key>
-    <dict>
-      <key>twistd</key>
-      <string>../Twisted/bin/twistd</string>
-    </dict>
-
-
-    <key>Localization</key>
-    <dict>
-      <key>TranslationsDirectory</key>
-      <string>locales</string>
-      <key>LocalesDirectory</key>
-      <string>locales</string>
-      <key>Language</key>
-      <string>en</string>
-    </dict>
-
-    <!--
-        Directory Address Book
-      -->
-    
-    <!--  Disable Directory Address Book -->
-    <!--
-      <key>DirectoryAddressBook</key>
-      <false/>
-    -->
-    
-    <!-- LDAP-backed Directory Address Book -->
-    <key>EnableSearchAddressBook</key>
-    <true/>
-    <key>DirectoryAddressBook</key>
-    <dict>
-        <key>Enabled</key>
-        <true/>
- 		<key>type</key>
-		<string>twistedcaldav.directory.ldapdirectorybacker.LdapDirectoryBackingService</string>
-		<key>params</key>
-		<dict>
-			<key>warningThresholdSeconds</key>
-			<integer>1</integer>
-			<key>appleInternalServer</key>
-			<true/>
-            <!-- fake uri, fill in.  -->
-			<key>uri</key>
-			<string>ldap://example.com/</string>
-            <!-- fill in auth info, if needed.  -->
-			<key>tls</key>
-			<false/>
-			<key>tlsCACertFile</key>
-			<string></string>
-			<key>tlsCACertDir</key>
-			<string></string>
-			<key>tlsRequireCert</key>
-			<string>never</string>
-			<key>credentials</key>
-			<dict/>
-			<key>authMethod</key>
-			<string>LDAP</string>
-			<key>rdnSchema</key>
-			<dict>
-				<key>base</key>
-                <string>o=apple.com,o=email</string>
-                <key>queries</key>
-                <array>
-                    <!-- people vCards -->
-                    <dict>
-                        <key>rdn</key>      <string>ou=People</string>
-                        <key>kind</key>      <string>individual</string>
-                        <key>filter</key>   <string></string>
-                        <!-- map from ab query to indexed ldap attribute.  If unindexed, too slow.  -->
-                         <key>additionalVCardProps</key>
-                            <dict>
-                                <key>NOTE</key>         <string>KIND: individual</string>
-                            </dict>
-                        <key>ldapAttrToDSAttrMap</key>
-                        <dict>
-                            <key>givenName</key>    <string>FirstName</string>
-                            <key>sn</key>           <string>LastName</string>
-                            <key>cn</key>           <string>RealName</string>
-                            <key>mail</key>         <string>EMailAddress</string>
-                            <key>uid</key>          <string>GeneratedUID</string>
-                        </dict>
-                        <key>vcardPropToLdapAttrMap</key>
-                        <dict>
-                            <key>FN</key>       <string>cn</string>
-                            <key>EMAIL</key>    <string>mail</string>
-                            <key>UID</key>      <string>uid</string>
-                        </dict>
-                    </dict>
-                    <!-- distribution list (group) vCards shown by 10.6-7 clients as a company. Does not hide groups below because UIDs are different -->
-                    <dict>
-                        <key>rdn</key>      <string>ou=Groups</string>
-                        <key>kind</key>     <string>org</string>
-                        <key>filter</key>   <string>(|(mail=*)(uniqueMember=*))</string> <!-- add a filter to skip uninteresting groups -->
-                        <key>ldapAttrToDSAttrMap</key>
-                        <dict>
-                            <key>givenName</key>    <string>FirstName</string>
-                            <key>sn</key>           <string>LastName</string>
-                            <key>description</key>  <string>RealName</string>
-                            <key>cn</key>           <string>RecordName</string>
-                            <key>mail</key>         <string>EMailAddress</string>
-                            <key>uniqueMember</key> <string>Comment</string>            <!-- debug only -->
-                        </dict>
-                        <key>vcardPropToLdapAttrMap</key>
-                        <dict>
-                            <key>FN</key>       <string>cn</string>
-                            <key>EMAIL</key>    <string>mail</string>
-                            <key>UID</key>      <string>cn</string>
-                        </dict>
-                    </dict>
-                    <!-- group vCards NOT shown 10.6-7 clients. Hopefully, future client will show these. Client can expand members with exact query on group member UID -->
-                    <dict>
-                        <key>rdn</key>      <string>ou=Groups</string>
-                        <key>kind</key>     <string>group</string>
-                        <key>filter</key>   <string>(|(mail=*)(uniqueMember=*))</string> <!-- add a filter to skip uninteresting groups -->
-                        <key>ldapAttrTransforms</key>
-                        <dict>
-                            <key>uniqueMember</key>
-                            <array>
-                                <string>uid</string>
-                                <string>cn</string>
-                            </array>
-                        </dict>
-                        <key>ldapAttrToDSAttrMap</key>
-                        <dict>
-                            <key>givenName</key>    <string>FirstName</string>
-                            <key>sn</key>           <string>LastName</string>
-                            <key>description</key>  <string>RealName</string>
-                            <key>cn</key>           <string>GeneratedUID</string>
-                            <key>mail</key>         <string>EMailAddress</string>
-                            <key>uniqueMember</key> <string>GroupMembers</string>
-                        </dict>
-                        <key>vcardPropToLdapAttrMap</key>
-                        <dict>
-                            <key>FN</key>       <string>cn</string>
-                            <key>EMAIL</key>    <string>mail</string>
-                            <key>UID</key>      <string>cn</string>
-                        </dict>
-                    </dict>
-                    <!-- group vCards shown by 10.6-7 clients as persons.  Future client should show as location.  Need to add Map URL or GEO -->
-                    <dict>
-                        <key>rdn</key>      <string>ou=places</string>
-                        <key>kind</key>     <string>location</string>
-                        <key>filter</key>   <string>(objectClass=apple-resource)</string>
-                        <!-- map from ab query to indexed ldap attribute.  If unindexed, too slow.  -->
-                         <key>additionalVCardProps</key>
-                            <dict>
-                                <key>NOTE</key> <string>KIND:location</string>
-                            </dict>
-                        <key>ldapAttrToDSAttrMap</key>
-                        <dict>
-                            <key>apple-realname</key>       <string>RealName</string>
-                            <key>apple-generateduid</key>   <string>GeneratedUID</string>
-                            <key>apple-mapguid</key>        <string>URL</string>
-                            <key>apple-capacity</key>       <string>URL</string>
-                        </dict>
-                        <key>vcardPropToLdapAttrMap</key>
-                        <dict>
-                            <key>FN</key>       <string>apple-realname</string>
-                            <key>UID</key>      <string>uid</string>
-                        </dict>
-                    </dict>
-                    <!-- calendarresource vCards shown by 10.6-7 clients as persons.  Just for testing only, at this point in time -->
-                    <dict>
-                        <key>rdn</key>      <string>ou=resources</string>
-                        <key>kind</key>     <string>calendarresource</string>
-                        <key>filter</key>   <string>(objectClass=apple-resource)</string>
-                         <key>additionalVCardProps</key>
-                            <dict>
-                                <key>NOTE</key> <string>KIND: calendarresource</string>
-                            </dict>
-                        <key>ldapAttrToDSAttrMap</key>
-                        <dict>
-                            <key>apple-realname</key>       <string>RealName</string>
-                            <key>apple-generateduid</key>   <string>GeneratedUID</string>
-                        </dict>
-                        <key>vcardPropToLdapAttrMap</key>
-                        <dict>
-                            <key>FN</key>       <string>cn</string>
-                            <key>EMAIL</key>    <string>mail</string>
-                            <key>UID</key>      <string>uid</string>
-                        </dict>
-                    </dict>
-                </array>
-			</dict>
-		</dict>
-   </dict>
-  </dict>
-</plist>

Modified: CalendarServer/branches/users/gaya/xmldirectorybacker/conf/carddav-odtest.plist
===================================================================
--- CalendarServer/branches/users/gaya/xmldirectorybacker/conf/carddav-odtest.plist	2013-10-10 18:51:46 UTC (rev 11803)
+++ CalendarServer/branches/users/gaya/xmldirectorybacker/conf/carddav-odtest.plist	2013-10-10 19:02:50 UTC (rev 11804)
@@ -1048,8 +1048,6 @@
        	  <!-- fake the eTag.  If false all directory service attributes are used to calculate the eTag -->
           <key>fakeETag</key>
           <true/>
-          <key>appleInternalServer</key>
-          <false/>
           <key>addDSAttrXProperties</key>
           <false/>
           <!-- add this key to use additional directory service attributes in queries.  Needed for some queries with directory service templates.

Modified: CalendarServer/branches/users/gaya/xmldirectorybacker/twistedcaldav/directory/directory.py
===================================================================
--- CalendarServer/branches/users/gaya/xmldirectorybacker/twistedcaldav/directory/directory.py	2013-10-10 18:51:46 UTC (rev 11803)
+++ CalendarServer/branches/users/gaya/xmldirectorybacker/twistedcaldav/directory/directory.py	2013-10-10 19:02:50 UTC (rev 11804)
@@ -671,7 +671,6 @@
         return self.add("group-cacher-lock", "1", expireTime=self.lockSeconds)
 
 
-
     def extendLock(self):
         """
         Update the expiration time of the memcached lock
@@ -690,6 +689,7 @@
         return self.delete("group-cacher-lock")
 
 
+
 class GroupMembershipCacheUpdater(object):
     """
     Responsible for updating memcached with group memberships.  This will run

Deleted: CalendarServer/branches/users/gaya/xmldirectorybacker/twistedcaldav/directory/ldapdirectorybacker.py
===================================================================
--- CalendarServer/branches/users/gaya/xmldirectorybacker/twistedcaldav/directory/ldapdirectorybacker.py	2013-10-10 18:51:46 UTC (rev 11803)
+++ CalendarServer/branches/users/gaya/xmldirectorybacker/twistedcaldav/directory/ldapdirectorybacker.py	2013-10-10 19:02:50 UTC (rev 11804)
@@ -1,370 +0,0 @@
-##
-# Copyright (c) 2006-2012 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.
-##
-
-
-"""
-Apple Open Directory directory service implementation for backing up directory-backed address books
-"""
-
-__all__ = [
-    "LdapDirectoryBackingService",
-]
-
-import traceback
-import ldap
-
-from twisted.internet.defer import inlineCallbacks, returnValue, succeed
-
-from twistedcaldav.config import config
-from twistedcaldav.directory.ldapdirectory import LdapDirectoryService, normalizeDNstr
-from twistedcaldav.directory.opendirectorybacker import ABDirectoryQueryResult, dsFilterFromAddressBookFilter, propertiesInAddressBookQuery
-
-
-class LdapDirectoryBackingService(LdapDirectoryService):
-    """
-    Directory backer for L{LdapDirectoryService}.
-    """
-
-    def __init__(self, params):
-        self._actuallyConfigure(**params)
-
-    def _actuallyConfigure(self, **params):
-
-        self.log.debug("_actuallyConfigure: params=%s" % (params,))
-        defaults = {
-            "recordTypes": (),  # for super
-            "rdnSchema": {
-                "base": "dc=example,dc=com",
-                "queries": (
-                    {  #people
-                        "rdn":"ou=people",
-                        "vcardPropToLdapAttrMap" : {  # maps vCard properties to searchable ldap attributes
-                            "FN" : "cn",
-                         },
-                        "ldapAttrToDSAttrMap" : {  # maps ldap attributes to ds attribute types
-                            "cn" : "dsAttrTypeStandard:RealName",
-                         },
-                        "additionalVCardProps":None,
-                    },
-                ),
-
-            },
-            "removeDuplicateUIDs":True,  # remove vCards with duplicate UIDs
-            "appleInternalServer":False,  # does magic in ABDirectoryQueryResult
-            "maxQueryResults":0,  # max records returned
-            "fakeETag":True,  # eTag is fake, otherwise it is md5(all attributes)
-       }
-
-        #params = self.getParams(params, defaults, ignored)
-        def addDefaults(params, defaults, remove=None):  # @UnusedVariable
-
-            for key in defaults:
-                if not key in params:
-                    params[key] = defaults[key]
-            return params
-
-        params = addDefaults(params, defaults)
-        self.log.debug("_actuallyConfigure after addDefaults: params=%s" % (params,))
-
-        # super does not like these extra params
-        directoryBackedAddressBook = params["directoryBackedAddressBook"]
-        del params["directoryBackedAddressBook"]
-        appleInternalServer = params["appleInternalServer"]
-        del params["appleInternalServer"]
-        maxQueryResults = params["maxQueryResults"]
-        del params["maxQueryResults"]
-        fakeETag = params["fakeETag"]
-        del params["fakeETag"]
-        removeDuplicateUIDs = params["removeDuplicateUIDs"]
-        del params["removeDuplicateUIDs"]
-
-
-        #standardize ds attributes type names
-        # or we could just require dsAttrTypeStandard: prefix in the plist
-        rdnSchema = params["rdnSchema"];
-        for query in rdnSchema["queries"]:
-            ldapAttrToDSAttrMap = query["ldapAttrToDSAttrMap"]
-            for ldapAttrName, dsAttrNames in ldapAttrToDSAttrMap.iteritems():
-                if not isinstance(dsAttrNames, list):
-                    dsAttrNames = [dsAttrNames, ]
-
-                normalizedDSAttrNames = []
-                for dsAttrName in dsAttrNames:
-                    if not dsAttrName.startswith("dsAttrTypeStandard:") and not dsAttrName.startswith("dsAttrTypeNative:"):
-                        normalizedDSAttrNames.append("dsAttrTypeStandard:" + dsAttrName)
-                    else:
-                        normalizedDSAttrNames.append(dsAttrName)
-
-                # not needed, but tests code paths
-                if len(normalizedDSAttrNames) > 1:
-                    ldapAttrToDSAttrMap[ldapAttrName] = normalizedDSAttrNames
-                else:
-                    ldapAttrToDSAttrMap[ldapAttrName] = normalizedDSAttrNames[0]
-
-
-        self.log.debug("_actuallyConfigure after clean: params=%s" % (params,))
-
-        assert directoryBackedAddressBook is not None
-        self.directoryBackedAddressBook = directoryBackedAddressBook
-
-        self.maxQueryResults = maxQueryResults
-
-        ### params for ABDirectoryQueryResult()
-        self.fakeETag = fakeETag
-        self.appleInternalServer = appleInternalServer
-        self.removeDuplicateUIDs = removeDuplicateUIDs
-
-        super(LdapDirectoryBackingService, self).__init__(params)
-
-
-    def createCache(self):
-        succeed(None)
-
-
-    @inlineCallbacks
-    def _getLdapQueryResults(self, base, queryStr, attributes=None, maxResults=0, ldapAttrToDSAttrMap=None, ldapAttrTransforms=None, additionalVCardProps=None, kind=None):
-        """
-        Get a list of ABDirectoryQueryResult for the given query with the given attributes.
-        query == None gets all records. attribute == None gets ABDirectoryQueryResult.allDSQueryAttributes
-        """
-        limited = False
-        resultsDictionary = {}
-
-        # can't resist also using a timeout, 1 sec per request result for now
-        timeout = maxResults
-
-        self.log.debug("_getLdapQueryResults: LDAP query base=%s and filter=%s and attributes=%s timeout=%s resultLimit=%s" % (ldap.dn.dn2str(base), queryStr, attributes, timeout, maxResults))
-
-        ldapSearchResult = (yield self.timedSearch(ldap.dn.dn2str(base), ldap.SCOPE_SUBTREE, filterstr=queryStr, attrlist=attributes, timeoutSeconds=timeout, resultLimit=maxResults))
-        self.log.debug("_getLdapQueryResults: ldapSearchResult=%s" % (ldapSearchResult,))
-
-        if maxResults and len(ldapSearchResult) >= maxResults:
-            limited = True
-            self.log.debug("_getLdapQueryResults: limit (= %d) reached." % (maxResults,))
-
-        for dn, ldapAttributes in ldapSearchResult:
-            #dn = normalizeDNstr(dn)
-            result = None
-            try:
-                if "dn" not in ldapAttributes:
-                    ldapAttributes["dn"] = [normalizeDNstr(dn), ]
-
-                # make a dsRecordAttributes dict from the ldap attributes
-                dsRecordAttributes = {}
-                for ldapAttributeName, ldapAttributeValues in ldapAttributes.iteritems():
-
-                    #self.log.debug("inspecting ldapAttributeName %s with values %s" % (ldapAttributeName, ldapAttributeValues,))
-
-                    # get rid of '' values
-                    ldapAttributeValues = [attr for attr in ldapAttributeValues if len(attr)]
-
-                    if len(ldapAttributeValues):
-
-                        dsAttributeNames = ldapAttrToDSAttrMap.get(ldapAttributeName)
-                        if dsAttributeNames:
-
-                            if ldapAttrTransforms:
-
-                                # do value transforms
-                                # need to expand this to cover all cases
-                                # All this does now is to pull part of an ldap string out
-                                # e.g: uid=renuka,ou=People,o=apple.com,o=email -> renuka
-                                transforms = ldapAttrTransforms.get(ldapAttributeName)
-                                if transforms:
-                                    if not isinstance(transforms, list):
-                                        transforms = [transforms, ]
-
-                                    transformedValues = []
-                                    for ldapAttributeValue in ldapAttributeValues:
-                                        transformedValue = ldapAttributeValue
-                                        for valuePart in normalizeDNstr(ldapAttributeValue).split(","):
-                                            kvPair = valuePart.split("=")
-                                            if len(kvPair) == 2:
-                                                for transform in transforms:
-                                                    if transform.lower() == kvPair[0]:
-                                                        transformedValue = kvPair[1]
-                                                        break
-
-                                        transformedValues += [transformedValue, ]
-
-                                    if (ldapAttributeValues != transformedValues):
-                                        self.log.debug("_getLdapQueryResults: %s %s transformed to %s" % (ldapAttributeName, ldapAttributeValues, transformedValues))
-                                        ldapAttributeValues = transformedValues
-
-                            if not isinstance(dsAttributeNames, list):
-                                dsAttributeNames = [dsAttributeNames, ]
-
-                            for dsAttributeName in dsAttributeNames:
-
-                                # base64 encode binary attributes
-                                if dsAttributeName in ABDirectoryQueryResult.binaryDSAttrNames:
-                                    ldapAttributeValues = [attr.encode('base64') for attr in ldapAttributeValues]
-
-                                # add to dsRecordAttributes
-                                if dsAttributeName not in dsRecordAttributes:
-                                    dsRecordAttributes[dsAttributeName] = list()
-
-                                dsRecordAttributes[dsAttributeName] = list(set(dsRecordAttributes[dsAttributeName] + ldapAttributeValues))
-                                self.log.debug("doAddressBookQuery: dsRecordAttributes[%s] = %s" % (dsAttributeName, dsRecordAttributes[dsAttributeName],))
-
-                # get a record for dsRecordAttributes
-                result = ABDirectoryQueryResult(self.directoryBackedAddressBook, dsRecordAttributes, kind=kind, additionalVCardProps=additionalVCardProps, appleInternalServer=self.appleInternalServer)
-            except:
-                traceback.print_exc()
-                self.log.info("Could not get vcard for %s" % (dn,))
-            else:
-                uid = result.vCard().propertyValue("UID")
-
-                if uid in resultsDictionary:
-                    self.log.info("Record skipped due to duplicate UID: %s" % (dn,))
-                    continue
-
-                self.log.debug("VCard text =\n%s" % (result.vCardText(),))
-                resultsDictionary[uid] = result
-
-        self.log.debug("%s results (limited=%s)." % (len(resultsDictionary), limited))
-        returnValue((resultsDictionary, limited,))
-
-
-    @inlineCallbacks
-    def doAddressBookQuery(self, addressBookFilter, addressBookQuery, maxResults):
-        """
-        Get vCards for a given addressBookFilter and addressBookQuery
-        """
-
-        results = {} if self.removeDuplicateUIDs else []
-
-        #one ldap query for each rnd in queries
-        for queryMap in self.rdnSchema["queries"]:
-
-            rdn = queryMap["rdn"]
-            vcardPropToLdapAttrMap = queryMap["vcardPropToLdapAttrMap"]
-            ldapAttrToDSAttrMap = queryMap["ldapAttrToDSAttrMap"]
-            additionalVCardProps = queryMap.get("additionalVCardProps")
-            ldapAttrTransforms = queryMap.get("ldapAttrTransforms")
-            kind = queryMap.get("kind", "individual")
-
-            # add constants and KIND
-            constantProperties = ABDirectoryQueryResult.constantProperties.copy()
-            if additionalVCardProps:
-                for key, value in additionalVCardProps.iteritems():
-                    if key not in constantProperties:
-                        constantProperties[key] = value
-
-            # add KIND as constant so that query can be skipped if addressBookFilter needs a different kind
-            constantProperties["KIND"] = kind
-
-            filterPropertyNames, dsFilter = dsFilterFromAddressBookFilter(addressBookFilter, vcardPropToLdapAttrMap, constantProperties=constantProperties);
-            self.log.debug("doAddressBookQuery: rdn=%s, query=%s, propertyNames=%s" % (rdn, dsFilter if isinstance(dsFilter, bool) else dsFilter.generate(), filterPropertyNames))
-
-            if dsFilter:
-                if dsFilter is True:
-                    dsFilter = None
-
-                # calculate minimum attributes needed for this query
-                etagRequested, queryPropNames = propertiesInAddressBookQuery(addressBookQuery)
-
-                if (etagRequested and not self.fakeETag) or not queryPropNames:
-                    queryAttributes = ldapAttrToDSAttrMap.keys()
-                elif queryPropNames:
-                    '''
-                    # To DO:  Need mapping from properties to returned attributes 
-                    queryPropNames += filterPropertyNames
-                    queryAttributes = []
-                    for prop in queryPropNames:
-                        attributes = ABDirectoryQueryResult.vcardPropToDSAttrMap.get(prop)
-                        if attributes:
-                            queryAttributes += attributes
-                    '''
-
-                    queryAttributes = ldapAttrToDSAttrMap.keys()
-
-                self.log.debug("doAddressBookQuery: etagRequested=%s, queryPropNames=%s, queryAttributes=%s" % (etagRequested, queryPropNames, queryAttributes,))
-
-                #get all ldap attributes -- for debug
-                if queryMap.get("getAllAttributes"):
-                    queryAttributes = None
-
-                base = ldap.dn.str2dn(rdn) + self.base
-
-                queryStr = "(cn=*)"  # all results query  - should make a param
-                #add additional filter from config
-                queryFilter = queryMap.get("filter")
-                if dsFilter and queryFilter:
-                    queryStr = "(&%s%s)" % (queryFilter, dsFilter.generate())
-                elif queryFilter:
-                    queryStr = queryFilter
-                elif dsFilter:
-                    queryStr = dsFilter.generate()
-
-                # keep trying ldap query till we get results based on filter.  Especially when doing "all results" query
-                remainingMaxResults = maxResults - len(results) if maxResults else 0
-                maxLdapResults = int(remainingMaxResults * 1.2)
-
-                while True:
-                    ldapQueryResultsDictionary, ldapQueryLimited = (yield self._getLdapQueryResults(base=base,
-                                                                                                    queryStr=queryStr,
-                                                                                                    attributes=queryAttributes,
-                                                                                                    maxResults=maxLdapResults,
-                                                                                                    kind=kind,
-                                                                                                    ldapAttrToDSAttrMap=ldapAttrToDSAttrMap,
-                                                                                                    ldapAttrTransforms=ldapAttrTransforms,
-                                                                                                    additionalVCardProps=additionalVCardProps))
-
-                    for uid, ldapQueryResult in ldapQueryResultsDictionary.iteritems():
-
-                        if self.removeDuplicateUIDs and uid in results:
-                            self.log.info("Record skipped due to duplicate UID: %s" % (uid,))
-                            continue
-
-                        if not addressBookFilter.match(ldapQueryResult.vCard()):
-                            self.log.debug("doAddressBookQuery did not match filter: %s (%s)" % (ldapQueryResult.vCard().propertyValue("FN"), uid,))
-                            continue
-
-                        if self.removeDuplicateUIDs:
-                            results[uid] = ldapQueryResult
-                        else:
-                            results += [ldapQueryResult, ]
-
-                    # no more results
-                    if not ldapQueryLimited:
-                        break;
-
-                    # more than requested results
-                    if maxResults and len(results) >= maxResults:
-                        break
-
-                    # more than max report results
-                    if len(results) >= config.MaxQueryWithDataResults:
-                        break
-
-                    # more than self limit
-                    if self.maxQueryResults and maxLdapResults >= self.maxQueryResults:
-                        break
-
-                    # try again with 2x
-                    maxLdapResults *= 2
-                    if self.maxQueryResults and maxLdapResults > self.maxQueryResults:
-                        maxLdapResults = self.maxQueryResults
-
-                if maxResults and len(results) >= maxResults:
-                    break
-
-        limited = maxResults and len(results) >= maxResults
-
-        self.log.info("limited %s len(results) %s" % (limited, len(results),))
-        returnValue((results.values() if self.removeDuplicateUIDs else results, limited,))
-

Modified: CalendarServer/branches/users/gaya/xmldirectorybacker/twistedcaldav/directory/opendirectorybacker.py
===================================================================
--- CalendarServer/branches/users/gaya/xmldirectorybacker/twistedcaldav/directory/opendirectorybacker.py	2013-10-10 18:51:46 UTC (rev 11803)
+++ CalendarServer/branches/users/gaya/xmldirectorybacker/twistedcaldav/directory/opendirectorybacker.py	2013-10-10 19:02:50 UTC (rev 11804)
@@ -37,7 +37,6 @@
 from twext.web2.http_headers import MimeType, generateContentType, ETag
 
 from twisted.internet.defer import inlineCallbacks, returnValue, deferredGenerator, succeed
-from twisted.python.reflect import namedModule
 
 from twistedcaldav import carddavxml
 from twistedcaldav.config import config
@@ -90,7 +89,6 @@
         fakeETag=True,  # eTag is not reliable if True
 
         addDSAttrXProperties=False,  # add dsattributes to vcards as "X-" attributes
-        appleInternalServer=False,
 
         additionalAttributes=None,
         allowedAttributes=None,
@@ -100,7 +98,7 @@
         """
         @queryPeopleRecords: C{True} to query for People records
         @queryUserRecords: C{True} to query for User records
-        @maxDSQueryRecords: maximum number of (unfiltered) ds records retrieved before raising 
+        @maxDSQueryRecords: maximum number of (unfiltered) ds records retrieved before raising
             NumberOfMatchesWithinLimits exception or returning results
         @dsLocalCacheTimeout: how log to keep cache of DSLocal records
         @fakeETag: C{True} to use a fake eTag; allows ds queries with partial attributes
@@ -136,7 +134,7 @@
         # get query info
         nodeDirectoryRecordTypeMap = {}
         for node in nodeRecordTypeMap:
-            queryInfo = {"recordTypes":nodeRecordTypeMap[node], }
+            queryInfo = {"recordTypes": nodeRecordTypeMap[node], }
             try:
                 queryInfo["directory"] = opendirectory.odInit(node)
             except opendirectory.ODError, e:
@@ -162,9 +160,7 @@
         self.fakeETag = fakeETag
 
         self.addDSAttrXProperties = addDSAttrXProperties
-        self.appleInternalServer = appleInternalServer
 
-
         if searchAttributes is None:
             # this is the intersection of ds default indexed attributes and ABDirectoryQueryResult.vcardPropToDSAttrMap.values()
             # so, not all indexed attributes are below
@@ -234,7 +230,6 @@
         self.returnedAttributes = list(set(returnedAttributes))
         self.log.debug("self.returnedAttributes=%s" % (self.returnedAttributes,))
 
-
         self._dsLocalResults = {}
         self._nextDSLocalQueryTime = 0
 
@@ -274,7 +269,6 @@
         Get a dictionary of ABDirectoryQueryResult by enumerating the local directory
         """
 
-
         def generateDSLocalResults():
 
             resultsDictionary = {}
@@ -295,7 +289,7 @@
                 self.log.error("Open Directory (node=%s) error: %s" % ("/Local/Default", str(ex)))
                 raise
 
-            for (recordShortName, recordAttributes) in records:  #@UnusedVariable
+            for recordShortName, recordAttributes in records: #@UnusedVariable
 
                 try:
                     self.log.info("Inspecting record %s" % (recordAttributes,))
@@ -318,10 +312,8 @@
                     self.log.debug("VCard text =\n%s" % (result.vCardText(),))
                     resultsDictionary[uid] = result
 
-
             return resultsDictionary
 
-
         if not self.queryDSLocal:
             return {}
 
@@ -350,7 +342,7 @@
         resultsDictionary = self._getAllDSLocalResults().copy()
         self.log.debug("Adding %s DSLocal results" % len(resultsDictionary.keys()))
 
-        for (recordShortName, recordAttributes) in records:  #@UnusedVariable
+        for (recordShortName, recordAttributes) in records: #@UnusedVariable
 
             try:
                 # fix ds strangeness
@@ -378,7 +370,6 @@
 
                 result = ABDirectoryQueryResult(self.directoryBackedAddressBook, recordAttributes,
                                      addDSAttrXProperties=self.addDSAttrXProperties,
-                                     appleInternalServer=self.appleInternalServer,
                                      )
             except Exception, e:
                 self.log.info("Could not get vcard for record %s:%s" % (recordShortName, e))
@@ -479,7 +470,6 @@
                 if maxRecords <= 0:
                     break
 
-
         elaspedTime = time.time() - startTime
         self.log.info("Timing: Directory query: %.1f ms (%d records, %.2f records/sec)" % (elaspedTime * 1000, len(allResults), len(allResults) / elaspedTime))
         return succeed(allResults)
@@ -491,15 +481,14 @@
         Get vCards for a given addressBookFilter and addressBookQuery
         """
 
-
         def allowedRecordTypes():
             constantProperties = ABDirectoryQueryResult.constantProperties.copy()
 
             # optimization: use KIND as constant to filter record type list
             dsRecordTypeToKindMap = {
-                           dsattributes.kDSStdRecordTypeGroups:"group",
-                           dsattributes.kDSStdRecordTypeLocations:"location",
-                           dsattributes.kDSStdRecordTypeResources:"device",
+                           dsattributes.kDSStdRecordTypeGroups: "group",
+                           dsattributes.kDSStdRecordTypeLocations: "location",
+                           dsattributes.kDSStdRecordTypeResources: "device",
                            }
 
             allowedRecordTypes = []
@@ -507,17 +496,16 @@
                 kind = dsRecordTypeToKindMap.get(recordType, "individual")
                 constantProperties["KIND"] = kind
 
-                filterPropertyNames, dsFilter = dsFilterFromAddressBookFilter(addressBookFilter,  #@UnusedVariable
+                filterPropertyNames, dsFilter = dsFilterFromAddressBookFilter(addressBookFilter, #@UnusedVariable
                                                                                          self.vcardPropToSearchableDSAttrMap,
-                                                                                         constantProperties=constantProperties);
+                                                                                         constantProperties=constantProperties)
                 if not dsFilter is False:
                     allowedRecordTypes += [recordType, ]
             return set(allowedRecordTypes)
 
-
         filterPropertyNames, dsFilter = dsFilterFromAddressBookFilter(addressBookFilter,
                                                                                  self.vcardPropToSearchableDSAttrMap,
-                                                                                 constantProperties=ABDirectoryQueryResult.constantProperties);
+                                                                                 constantProperties=ABDirectoryQueryResult.constantProperties)
         self.log.debug("doAddressBookQuery: query=%s, propertyNames=%s" % (dsFilter if isinstance(dsFilter, bool) else dsFilter.generate(), filterPropertyNames,))
 
         results = []
@@ -548,11 +536,11 @@
             # change query to ignore system records rather than post filtering
             # but this is broken in open directory client
             if self.ignoreSystemRecords:
-                ignoreExpression = dsquery.expression(dsquery.expression.NOT, 
+                ignoreExpression = dsquery.expression(dsquery.expression.NOT,
                                                        dsquery.match(dsattributes.kDS1AttrGeneratedUID, "FFFFEEEE-DDDD-CCCC-BBBB-AAAA", dsattributes.eDSStartsWith)
                                                        )
                 filterAttributes = list(set(filterAttributes).union(dsattributes.kDS1AttrGeneratedUID))
-                
+
                 dsFilter = dsquery.expression(dsquery.expression.AND, (dsFilter, ignoreExpression,)) if dsFilter else ignoreExpression
             '''
             maxRecords = int(maxResults * 1.2)
@@ -570,7 +558,7 @@
 
                 #no more results
                 if not dsQueryLimited:
-                    break;
+                    break
 
                 # more than requested results
                 if maxResults and len(filteredResults) >= maxResults:
@@ -589,7 +577,6 @@
                 if self.maxDSQueryRecords and maxRecords > self.maxDSQueryRecords:
                     maxRecords = self.maxDSQueryRecords
 
-
             results = filteredResults
             limited = maxResults and len(results) >= maxResults
 
@@ -600,7 +587,7 @@
         returnValue((results, limited,))
 
 
-#utility
+
 def propertiesInAddressBookQuery(addressBookQuery):
     """
     Get the vCard properties requested by a given query
@@ -623,6 +610,7 @@
     return (etagRequested, propertyNames if len(propertyNames) else None)
 
 
+
 def dsFilterFromAddressBookFilter(addressBookFilter, vcardPropToSearchableAttrMap, constantProperties={}):
     """
     Convert the supplied addressbook-query into a ds expression tree.
@@ -633,7 +621,6 @@
     @return: (filterProperyNames, expressions) tuple.  expression==True means list all results, expression==False means no results
     """
 
-
     def propFilterListQuery(filterAllOf, propFilters):
 
         def combineExpressionLists(expressionList, allOf, addedExpressions):
@@ -675,12 +662,11 @@
         def propFilterExpression(filterAllOf, propFilter):
             """
             Create an expression for a single prop-filter element.
-            
+
             @param propFilter: the L{PropertyFilter} element.
             @return: (filterProperyNames, expressions) tuple.  expression==True means list all results, expression==False means no results
             """
 
-
             def definedExpression(defined, allOf):
                 if constant or propFilter.filter_name in ("N" , "FN", "UID", "SOURCE",):
                     return defined  # all records have this property so no records do not have it
@@ -706,7 +692,7 @@
                 #end andOrExpression()
 
 
-            def paramFilterElementExpression(propFilterAllOf, paramFilterElement):  #@UnusedVariable
+            def paramFilterElementExpression(propFilterAllOf, paramFilterElement): #@UnusedVariable
 
                 params = ABDirectoryQueryResult.vcardPropToParamMap.get(propFilter.filter_name.upper())
                 defined = params and paramFilterElement.filter_name.upper() in params
@@ -867,7 +853,7 @@
 
         """
         Create an expression for a list of prop-filter elements.
-        
+
         @param filterAllOf: the C{True} if parent filter test is "allof"
         @param propFilters: the C{list} of L{ComponentFilter} elements.
         @return: (filterProperyNames, expressions) tuple.  expression==True means list all results, expression==False means no results
@@ -927,7 +913,7 @@
 
     vcardPropToDSAttrMap = {
 
-        "FN" : [
+        "FN": [
                dsattributes.kDS1AttrFirstName,
                dsattributes.kDS1AttrLastName,
                dsattributes.kDS1AttrMiddleName,
@@ -936,7 +922,7 @@
                dsattributes.kDS1AttrDistinguishedName,
                dsattributes.kDSNAttrRecordName,
                ],
-        "N" : [
+        "N": [
                dsattributes.kDS1AttrFirstName,
                dsattributes.kDS1AttrLastName,
                dsattributes.kDS1AttrMiddleName,
@@ -945,17 +931,17 @@
                dsattributes.kDS1AttrDistinguishedName,
                dsattributes.kDSNAttrRecordName,
                ],
-        "NICKNAME" : [
+        "NICKNAME": [
                 dsattributes.kDSNAttrNickName,
                 ],
         # no binary searching
-        "PHOTO" : [
+        "PHOTO": [
                 (dsattributes.kDSNAttrJPEGPhoto, "base64"),
                 ],
-        "BDAY" : [
+        "BDAY": [
                 dsattributes.kDS1AttrBirthday,
                 ],
-        "ADR" : [
+        "ADR": [
                 dsattributes.kDSNAttrBuilding,
                 dsattributes.kDSNAttrStreet,
                 dsattributes.kDSNAttrCity,
@@ -963,14 +949,14 @@
                 dsattributes.kDSNAttrPostalCode,
                 dsattributes.kDSNAttrCountry,
                 ],
-        "LABEL" : [
+        "LABEL": [
                 dsattributes.kDSNAttrPostalAddress,
                 dsattributes.kDSNAttrPostalAddressContacts,
                 dsattributes.kDSNAttrAddressLine1,
                 dsattributes.kDSNAttrAddressLine2,
                 dsattributes.kDSNAttrAddressLine3,
                 ],
-         "TEL" : [
+         "TEL": [
                 dsattributes.kDSNAttrPhoneNumber,
                 dsattributes.kDSNAttrMobileNumber,
                 dsattributes.kDSNAttrPagerNumber,
@@ -979,50 +965,49 @@
                 dsattributes.kDSNAttrFaxNumber,
                 #dsattributes.kDSNAttrAreaCode,
                 ],
-         "EMAIL" : [
+         "EMAIL": [
                 dsattributes.kDSNAttrEMailAddress,
                 dsattributes.kDSNAttrEMailContacts,
                 ],
-         "GEO" : [
+         "GEO": [
                 dsattributes.kDSNAttrMapCoordinates,
                 ],
-         "TITLE" : [
+         "TITLE": [
                 dsattributes.kDSNAttrJobTitle,
                 ],
-         "ORG" : [
+         "ORG": [
                 dsattributes.kDSNAttrCompany,
                 dsattributes.kDSNAttrOrganizationName,
                 dsattributes.kDSNAttrDepartment,
                 ],
-         "NOTE" : [
+         "NOTE": [
                 dsattributes.kDS1AttrComment,
                 dsattributes.kDS1AttrNote,
                 ],
-         "REV" : [
+         "REV": [
                 dsattributes.kDS1AttrModificationTimestamp,
                 ],
-         "UID" : [
+         "UID": [
                 dsattributes.kDS1AttrGeneratedUID,
                 dsattributes.kDSNAttrRecordName,
                 ],
-         "URL" : [
+         "URL": [
                 dsattributes.kDS1AttrWeblogURI,
                 dsattributes.kDSNAttrURL,
                 ],
-         "KEY" : [
-                # check on format, are these all binary?
+         "KEY": [
                 (dsattributes.kDSNAttrPGPPublicKey, "base64"),
                 (dsattributes.kDS1AttrUserCertificate, "base64"),
                 (dsattributes.kDS1AttrUserPKCS12Data, "base64"),
                 (dsattributes.kDS1AttrUserSMIMECertificate, "base64"),
                 ],
-         "IMPP" : [
+         "IMPP": [
                 dsattributes.kDSNAttrIMHandle,
                 ],
-         "X-ABRELATEDNAMES" :  [
+         "X-ABRELATEDNAMES": [
                 dsattributes.kDSNAttrRelationships,
                 ],
-         "SOURCE" : [
+         "SOURCE": [
                 dsattributes.kDS1AttrGeneratedUID,
                 dsattributes.kDSNAttrRecordName,
                 ],
@@ -1031,31 +1016,30 @@
     allDSQueryAttributes = list(set([attr for lookupAttributes in vcardPropToDSAttrMap.values()
                                       for attr in lookupAttributes]))
     binaryDSAttrNames = [attr[0] for attr in allDSQueryAttributes
-                                if isinstance(attr, tuple) ]
+                                if isinstance(attr, tuple)]
     stringDSAttrNames = [attr for attr in allDSQueryAttributes
-                                if isinstance(attr, str) ]
+                                if isinstance(attr, str)]
     allDSAttrNames = stringDSAttrNames + binaryDSAttrNames
 
     # all possible generated parameters.
     vcardPropToParamMap = {
-        "PHOTO": { "ENCODING": ("B",), "TYPE": ("JPEG",), },
-        "ADR": { "TYPE": ("WORK", "PREF", "POSTAL", "PARCEL",), },
-        "LABEL": { "TYPE": ("POSTAL", "PARCEL",)},
-        "TEL": { "TYPE": None, },  # None means param can contain can be anything
-        "EMAIL": { "TYPE": None, },
-        "KEY": { "ENCODING": ("B",), "TYPE": ("PGPPUBILICKEY", "USERCERTIFICATE", "USERPKCS12DATA", "USERSMIMECERTIFICATE",) },
-        "URL": { "TYPE": ("WEBLOG", "HOMEPAGE",) },
-        "IMPP": { "TYPE": ("PREF",), "X-SERVICE-TYPE": None, },
-        "X-ABRELATEDNAMES" : { "TYPE":None, },
-        "X-AIM": { "TYPE": ("PREF",), },
-        "X-JABBER": { "TYPE": ("PREF",), },
-        "X-MSN": { "TYPE": ("PREF",), },
-        "X-ICQ": { "TYPE": ("PREF",), },
+        "PHOTO": {"ENCODING": ("B",), "TYPE": ("JPEG",), },
+        "ADR": {"TYPE": ("WORK", "PREF", "POSTAL", "PARCEL",), },
+        "LABEL": {"TYPE": ("POSTAL", "PARCEL",)},
+        "TEL": {"TYPE": None, },  # None means param can contain can be anything
+        "EMAIL": {"TYPE": None, },
+        "KEY": {"ENCODING": ("B",), "TYPE": ("PGPPUBILICKEY", "USERCERTIFICATE", "USERPKCS12DATA", "USERSMIMECERTIFICATE",)},
+        "URL": {"TYPE": ("WEBLOG", "HOMEPAGE",)},
+        "IMPP": {"TYPE": ("PREF",), "X-SERVICE-TYPE": None, },
+        "X-ABRELATEDNAMES": {"TYPE": None, },
+        "X-AIM": {"TYPE": ("PREF",), },
+        "X-JABBER": {"TYPE": ("PREF",), },
+        "X-MSN": {"TYPE": ("PREF",), },
+        "X-ICQ": {"TYPE": ("PREF",), },
     }
 
     uidSeparator = "-cf07a1a2-"
 
-
     constantProperties = {
         # 3.6.3 PRODID Type Definition
         "PRODID": vCardProductID,
@@ -1068,7 +1052,6 @@
                  kind=None,
                  additionalVCardProps=None,
                  addDSAttrXProperties=False,
-                 appleInternalServer=False,
                  ):
 
         self.log.debug("directoryBackedAddressBook=%s, attributes=%s, additionalVCardProps=%s" % (directoryBackedAddressBook, recordAttributes, additionalVCardProps,))
@@ -1082,10 +1065,9 @@
         self.log.debug("directoryBackedAddressBook=%s, attributes=%s, self.constantProperties=%s" % (directoryBackedAddressBook, recordAttributes, self.constantProperties,))
 
         #save off for debugging
-        self.addDSAttrXProperties = addDSAttrXProperties;
+        self.addDSAttrXProperties = addDSAttrXProperties
         if addDSAttrXProperties:
             self.originalAttributes = recordAttributes.copy()
-        self.appleInternalServer = appleInternalServer
 
         self._directoryBackedAddressBook = directoryBackedAddressBook
         self._vCard = None
@@ -1114,20 +1096,18 @@
             dsRecordTypeToKindMap = {
                            #dsattributes.kDSStdRecordTypePeople:"individual",
                            #dsattributes.kDSStdRecordTypeUsers:"individual",
-                           dsattributes.kDSStdRecordTypeGroups:"group",
-                           dsattributes.kDSStdRecordTypeLocations:"location",
-                           dsattributes.kDSStdRecordTypeResources:"device",
+                           dsattributes.kDSStdRecordTypeGroups: "group",
+                           dsattributes.kDSStdRecordTypeLocations: "location",
+                           dsattributes.kDSStdRecordTypeResources: "device",
                            }
             recordType = self.firstValueForAttribute(dsattributes.kDSNAttrRecordType)
             kind = dsRecordTypeToKindMap.get(recordType, "individual")
         self.kind = kind.lower()
 
-
         #generate a vCard here.  May throw an exception
         self.vCard()
 
 
-
     def __repr__(self):
         return "<%s[%s(%s)]>" % (
             self.__class__.__name__,
@@ -1157,7 +1137,7 @@
 
         # ds templates often return empty attribute values
         #     get rid of them here
-        nonEmptyValues = [(value.encode("utf-8") if isinstance(value, unicode) else value) for value in values if len(value) > 0 ]
+        nonEmptyValues = [(value.encode("utf-8") if isinstance(value, unicode) else value) for value in values if len(value) > 0]
 
         if len(nonEmptyValues) > 0:
             return nonEmptyValues
@@ -1194,10 +1174,8 @@
         return revDate
 
 
-
     def vCard(self):
 
-
         def generateVCard():
 
             def isUniqueProperty(vcard, newProperty, ignoreParams=None):
@@ -1232,13 +1210,6 @@
                 preferred = True
                 for attrValue in self.valuesForAttribute(attrType):
                     try:
-                        # special case for Apple
-                        if self.appleInternalServer and attrType == dsattributes.kDSNAttrIMHandle:
-                            splitValue = attrValue.split("|")
-                            if len (splitValue) > 1:
-                                attrValue = splitValue[0]
-                                if splitValue[1].upper() in nolabelParamTypes:
-                                    defaultLabel = splitValue[1]
 
                         colonIndex = attrValue.find(":")
                         if (colonIndex > len(attrValue) - 2):
@@ -1249,7 +1220,7 @@
                         paramTypeString = labelString.upper()
 
                         if specialParamType:
-                            parameters = { specialParamType: (paramTypeString,) }
+                            parameters = {specialParamType: (paramTypeString,)}
                             if preferred:
                                 parameters["TYPE"] = ("PREF",)
                         else:
@@ -1257,7 +1228,7 @@
                             paramTypeStrings = [paramTypeString, ]
                             if preferred and "PREF" != paramTypeString:
                                 paramTypeStrings += ["PREF", ]
-                            parameters = { "TYPE": paramTypeStrings, }
+                            parameters = {"TYPE": paramTypeStrings, }
 
                         #special case for IMHandles which the param is the last part of the property like X-AIM or X-JABBER
                         if propertyPrefix:
@@ -1276,7 +1247,6 @@
                         self.log.debug("addPropertiesAndLabelsForPrefixedAttribute(): groupCount=%r, propertyPrefix=%r, propertyName=%r, nolabelParamTypes=%r, labelMap=%r, attrType=%r" % (groupCount[0], propertyPrefix, propertyName, nolabelParamTypes, labelMap, attrType,))
                         self.log.error("addPropertiesAndLabelsForPrefixedAttribute(): Trouble parsing attribute %s, with value \"%s\".  Error = %s" % (attrType, attrValue, e,))
 
-
             # create vCard
             vcard = Component("VCARD")
             groupCount = [0]
@@ -1340,10 +1310,9 @@
             # pyOpenDirectory always returns binary-encoded string
 
             for photo in self.valuesForAttribute(dsattributes.kDSNAttrJPEGPhoto):
-                photo = "".join("".join(photo.split("\r")).split("\n"))  #get rid of line folding: for PHOTO
+                photo = "".join("".join(photo.split("\r")).split("\n")) # get rid of line folding: for PHOTO
                 addUniqueProperty(vcard, Property("PHOTO", photo, params={"ENCODING": ["b", ], "TYPE": ["JPEG", ], }), None, dsattributes.kDSNAttrJPEGPhoto, photo)
 
-
             # 3.1.5 BDAY Type Definition
             # dsattributes.kDS1AttrBirthday,            # Single-valued attribute that defines the user's birthday.
                                                         #      Format is x.208 standard YYYYMMDDHHMMSSZ which we will require as GMT time.
@@ -1353,7 +1322,6 @@
             if birthdate:
                 vcard.addProperty(Property("BDAY", PyCalendarDateTime.parseText(birthdate, fullISO=True)))
 
-
             # 3.2 Delivery Addressing Types http://tools.ietf.org/html/rfc2426#section-3.2
             #
             # 3.2.1 ADR Type Definition
@@ -1381,9 +1349,8 @@
                     params={"TYPE": ["WORK", "PREF", "POSTAL", "PARCEL", ], }
                 ))
 
-
             # 3.2.2 LABEL Type Definition
-
+            #
             # dsattributes.kDSNAttrPostalAddress,           # The postal address usually excluding postal code.
             # dsattributes.kDSNAttrPostalAddressContacts,   # multi-valued attribute that defines a record's alternate postal addresses .
                                                             #      found in user records (kDSStdRecordTypeUsers) and resource records (kDSStdRecordTypeResources).
@@ -1432,25 +1399,25 @@
                 addUniqueProperty(vcard, Property("TEL", phone, params=params), (("TYPE", "PREF"),), phone, dsattributes.kDSNAttrPhoneNumber)
                 params = {"TYPE": ["WORK", "VOICE", ], }
 
-            params = { "TYPE": ["WORK", "PREF", "CELL", ], }
+            params = {"TYPE": ["WORK", "PREF", "CELL", ], }
             for phone in self.valuesForAttribute(dsattributes.kDSNAttrMobileNumber):
                 addUniqueProperty(vcard, Property("TEL", phone, params=params), (("TYPE", "PREF"),), phone, dsattributes.kDSNAttrMobileNumber)
-                params = { "TYPE": ["WORK", "CELL", ], }
+                params = {"TYPE": ["WORK", "CELL", ], }
 
-            params = { "TYPE": ["WORK", "PREF", "FAX", ], }
+            params = {"TYPE": ["WORK", "PREF", "FAX", ], }
             for phone in self.valuesForAttribute(dsattributes.kDSNAttrFaxNumber):
                 addUniqueProperty(vcard, Property("TEL", phone, params=params), (("TYPE", "PREF"),), phone, dsattributes.kDSNAttrFaxNumber)
-                params = { "TYPE": ["WORK", "FAX", ], }
+                params = {"TYPE": ["WORK", "FAX", ], }
 
-            params = { "TYPE": ["WORK", "PREF", "PAGER", ], }
+            params = {"TYPE": ["WORK", "PREF", "PAGER", ], }
             for phone in self.valuesForAttribute(dsattributes.kDSNAttrPagerNumber):
                 addUniqueProperty(vcard, Property("TEL", phone, params=params), (("TYPE", "PREF"),), phone, dsattributes.kDSNAttrPagerNumber)
-                params = { "TYPE": ["WORK", "PAGER", ], }
+                params = {"TYPE": ["WORK", "PAGER", ], }
 
-            params = { "TYPE": ["HOME", "PREF", "VOICE", ], }
+            params = {"TYPE": ["HOME", "PREF", "VOICE", ], }
             for phone in self.valuesForAttribute(dsattributes.kDSNAttrHomePhoneNumber):
                 addUniqueProperty(vcard, Property("TEL", phone, params=params), (("TYPE", "PREF"),), phone, dsattributes.kDSNAttrHomePhoneNumber)
-                params = { "TYPE": ["HOME", "VOICE", ], }
+                params = {"TYPE": ["HOME", "VOICE", ], }
 
             addPropertiesAndLabelsForPrefixedAttribute(groupCount=groupCount, propertyPrefix=None, propertyName="TEL", defaultLabel="work",
                                                         nolabelParamTypes=("VOICE", "CELL", "FAX", "PAGER",),
@@ -1465,8 +1432,8 @@
             # dsattributes.kDSNAttrEMailAddress,        # Email address of usually a user record.
 
             # setup some params
-            preferredWorkParams = { "TYPE": ["WORK", "PREF", "INTERNET", ], }
-            workParams = { "TYPE": ["WORK", "INTERNET", ], }
+            preferredWorkParams = {"TYPE": ["WORK", "PREF", "INTERNET", ], }
+            workParams = {"TYPE": ["WORK", "INTERNET", ], }
             params = preferredWorkParams
             for emailAddress in self.valuesForAttribute(dsattributes.kDSNAttrEMailAddress):
                 addUniqueProperty(vcard, Property("EMAIL", emailAddress, params=params), (("TYPE", "PREF"),), emailAddress, dsattributes.kDSNAttrEMailAddress)
@@ -1530,7 +1497,7 @@
             # 3.6.2 NOTE Type Definition
             # dsattributes.kDS1AttrComment,               # Attribute used for unformatted comment.
             # dsattributes.kDS1AttrNote,                  # Note attribute. Commonly used in printer records.
-            notes = self.valuesForAttribute(dsattributes.kDS1AttrComment, []) + self.valuesForAttribute(dsattributes.kDS1AttrNote, []);
+            notes = self.valuesForAttribute(dsattributes.kDS1AttrComment, []) + self.valuesForAttribute(dsattributes.kDS1AttrNote, [])
             if len(notes):
                 vcard.addProperty(Property("NOTE", "\n".join(notes),))
 
@@ -1556,7 +1523,6 @@
 
             vcard.addProperty(Property("UID", self.firstValueForAttribute(dsattributes.kDS1AttrGeneratedUID)))
 
-
             # 3.6.8 URL Type Definition
             # dsattributes.kDSNAttrURL,                 # List of URLs.
             # dsattributes.kDS1AttrWeblogURI,           # Single-valued attribute that defines the URI of a user's weblog.
@@ -1568,26 +1534,15 @@
             for url in self.valuesForAttribute(dsattributes.kDSNAttrURL):
                 addPropertyAndLabel(groupCount, "_$!<HomePage>!$_", "URL", url, parameters={"TYPE": ["HOMEPAGE", ]})
 
-            # special case for Apple
-            if self.appleInternalServer:
-                urlbase = {"individual":"adir://employees/",
-                           "group":"adir://groups/",
-                           "org":"adir://groups/",
-                           "location":"adir://conferencerooms/",
-                           }.get(self.kind)
-                if urlbase:
-                    addPropertyAndLabel(groupCount, "\xef\xa3\xbf Directory", "URL", urlbase + self.firstValueForAttribute(dsattributes.kDS1AttrGeneratedUID), parameters={"TYPE": ["HOMEPAGE", ]})
-
-
             # 3.6.9 VERSION Type Definition
             # ALREADY ADDED
-
+            #
             # 3.7 SECURITY TYPES http://tools.ietf.org/html/rfc2426#section-3.7
             # 3.7.1 CLASS Type Definition
             # ALREADY ADDED
-
+            #
             # 3.7.2 KEY Type Definition
-
+            #
             # dsattributes.kDSNAttrPGPPublicKey,        # Pretty Good Privacy public encryption key.
             # dsattributes.kDS1AttrUserCertificate,     # Attribute containing the binary of the user's certificate.
                                                         #       Usually found in user records. The certificate is data which identifies a user.
@@ -1628,8 +1583,6 @@
                                                         nolabelParamTypes=imNolabelParamTypes,
                                                         attrType=dsattributes.kDSNAttrIMHandle,)
 
-
-
             # IMPP
             # Address Book's implementation of http://tools.ietf.org/html/rfc6350#section-6.4.3
             # adding IMPP property allows ab query report search on one property
@@ -1643,37 +1596,19 @@
                                                         #      found in user records (kDSStdRecordTypeUsers).
                                                         #      Example: brother:John
             addPropertiesAndLabelsForPrefixedAttribute(groupCount=groupCount, propertyPrefix=None, propertyName="X-ABRELATEDNAMES", defaultLabel="friend",
-                                                        labelMap={   "FATHER":"_$!<Father>!$_",
-                                                            "MOTHER":"_$!<Mother>!$_",
-                                                            "PARENT":"_$!<Parent>!$_",
-                                                            "BROTHER":"_$!<Brother>!$_",
-                                                            "SISTER":"_$!<Sister>!$_",
-                                                            "CHILD":"_$!<Child>!$_",
-                                                            "FRIEND":"_$!<Friend>!$_",
-                                                            "SPOUSE":"_$!<Spouse>!$_",
-                                                            "PARTNER":"_$!<Partner>!$_",
-                                                            "ASSISTANT":"_$!<Assistant>!$_",
-                                                            "MANAGER":"_$!<Manager>!$_", },
+                                                        labelMap={"FATHER": "_$!<Father>!$_",
+                                                            "MOTHER": "_$!<Mother>!$_",
+                                                            "PARENT": "_$!<Parent>!$_",
+                                                            "BROTHER": "_$!<Brother>!$_",
+                                                            "SISTER": "_$!<Sister>!$_",
+                                                            "CHILD": "_$!<Child>!$_",
+                                                            "FRIEND": "_$!<Friend>!$_",
+                                                            "SPOUSE": "_$!<Spouse>!$_",
+                                                            "PARTNER": "_$!<Partner>!$_",
+                                                            "ASSISTANT": "_$!<Assistant>!$_",
+                                                            "MANAGER": "_$!<Manager>!$_", },
                                                         attrType=dsattributes.kDSNAttrRelationships,)
 
-
-            # special case for Apple
-            if self.appleInternalServer:
-                for manager in self.valuesForAttribute("dsAttrTypeNative:appleManager"):
-                    splitManager = manager.split("|")
-                    if len(splitManager) >= 2:
-                        # first name, last name
-                        managerValue = "%s %s" % (splitManager[0], splitManager[1])
-                    else:
-                        managerValue = manager
-                    addPropertyAndLabel(groupCount, "_$!<Manager>!$_", "X-ABRELATEDNAMES", managerValue, parameters={ "TYPE": ["MANAGER", ]})
-
-                    if len(splitManager) >= 4:
-                        # email
-                        addPropertyAndLabel(groupCount, "_$!<Manager>!$_", "X-ABRELATEDNAMES", splitManager[3], parameters={ "TYPE": ["MANAGER", ]})
-
-
-
             # add apple-defined group vcard properties if record type is group
             if self.kind == "group":
                 vcard.addProperty(Property("X-ADDRESSBOOKSERVER-KIND", "group"))
@@ -1684,23 +1619,23 @@
 
             """
             # UNIMPLEMENTED: X- attributes
-            
+
             X-MAIDENNAME
             X-PHONETIC-FIRST-NAME
             X-PHONETIC-MIDDLE-NAME
             X-PHONETIC-LAST-NAME
-        
+
             sattributes.kDS1AttrPicture,                # Represents the path of the picture for each user displayed in the login window.
                                                         #      Found in user records (kDSStdRecordTypeUsers).
-           
+
             dsattributes.kDS1AttrMapGUID,               # Represents the GUID for a record's map.
             dsattributes.kDSNAttrMapURI,                # attribute that defines the URI of a user's location.
-    
+
             dsattributes.kDSNAttrOrganizationInfo,      # Usually the organization info of a user.
             dsattributes.kDSNAttrAreaCode,              # Area code of a user's phone number.
-    
-            dsattributes.kDSNAttrMIME,                  # Data contained in this attribute type is a fully qualified MIME Type. 
-            
+
+            dsattributes.kDSNAttrMIME,                  # Data contained in this attribute type is a fully qualified MIME Type.
+
             """
 
             # 2.1.4 SOURCE Type http://tools.ietf.org/html/rfc2426#section-2.1.4
@@ -1735,7 +1670,6 @@
             if self.kind == "org":
                 vcard.addProperty(Property("X-ABShowAs", "COMPANY"))
 
-
             # debug, create X-attributes for all ds attributes
             if self.addDSAttrXProperties:
                 for attribute in self.originalAttributes:
@@ -1744,7 +1678,6 @@
 
             return vcard
 
-
         if not self._vCard:
             self._vCard = generateVCard()
 
@@ -1773,7 +1706,7 @@
 
         if namespace == dav_namespace:
             if name == "resourcetype":
-                result = davxml.ResourceType.empty  #@UndefinedVariable
+                result = davxml.ResourceType.empty #@UndefinedVariable
                 return result
             elif name == "getetag":
                 result = davxml.GETETag(ETag(hashlib.md5(self.vCardText()).hexdigest()).generate())
@@ -1843,10 +1776,8 @@
     listProperties = deferredGenerator(listProperties)
 
 
-# utility
+
 #remove illegal XML
 def removeControlChars(utf8String):
     result = ''.join([c for c in utf8String if c not in "\x01\x02\x03\x04\x05\x06\x07\x08\x0b\x0c\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f"])
     return result
-
-

Modified: CalendarServer/branches/users/gaya/xmldirectorybacker/twistedcaldav/directory/xmldirectorybacker.py
===================================================================
--- CalendarServer/branches/users/gaya/xmldirectorybacker/twistedcaldav/directory/xmldirectorybacker.py	2013-10-10 18:51:46 UTC (rev 11803)
+++ CalendarServer/branches/users/gaya/xmldirectorybacker/twistedcaldav/directory/xmldirectorybacker.py	2013-10-10 19:02:50 UTC (rev 11804)
@@ -40,72 +40,73 @@
     def __init__(self, params):
         self._actuallyConfigure(**params)
 
+
     def _actuallyConfigure(self, **params):
 
         self.log.debug("_actuallyConfigure: params=%s" % (params,))
         defaults = {
             "recordTypes": (self.recordType_users, self.recordType_groups,),
             "rdnSchema": {
-                self.recordType_users : {
-                    "vcardPropToDirRecordAttrMap" : {
-                        "FN" : (
+                self.recordType_users: {
+                    "vcardPropToDirRecordAttrMap": {
+                        "FN": (
                                 "fullName",
                                 "shortNames",
                                 "firstName",
                                 "lastName",
                                 ),
-                        "N" : (
+                        "N": (
                                 "fullName",
                                 "shortNames",
                                 "firstName",
                                 "lastName",
                                 ),
-                        "EMAIL" : "emailAddresses",
-                        "UID" : "guid",
+                        "EMAIL": "emailAddresses",
+                        "UID": "guid",
                      },
-                     "dirRecordAttrToDSAttrMap" : {
-                        "guid" :            dsattributes.kDS1AttrGeneratedUID,
-                        "fullName" :        dsattributes.kDS1AttrDistinguishedName,
-                        "firstName" :       dsattributes.kDS1AttrFirstName,
-                        "lastName" :        dsattributes.kDS1AttrLastName,
-                        "emailAddresses" :  dsattributes.kDSNAttrEMailAddress,
+                     "dirRecordAttrToDSAttrMap": {
+                        "guid": dsattributes.kDS1AttrGeneratedUID,
+                        "fullName": dsattributes.kDS1AttrDistinguishedName,
+                        "firstName": dsattributes.kDS1AttrFirstName,
+                        "lastName": dsattributes.kDS1AttrLastName,
+                        "emailAddresses": dsattributes.kDSNAttrEMailAddress,
                      },
                 },
-                self.recordType_groups : {
-                    "vcardPropToDirRecordAttrMap" : {
-                        "FN" : (
+                self.recordType_groups: {
+                    "vcardPropToDirRecordAttrMap": {
+                        "FN": (
                                 "fullName",
                                 "shortNames",
                                 "firstName",
                                 "lastName",
                                 ),
-                        "N" : (
+                        "N": (
                                 "fullName",
                                 "shortNames",
                                 "firstName",
                                 "lastName",
                                 ),
-                        "EMAIL" : "emailAddresses",
-                        "UID" : "guid",
-                        "X-ADDRESSBOOKSERVER-MEMBER" : "members",
+                        "EMAIL": "emailAddresses",
+                        "UID": "guid",
+                        "X-ADDRESSBOOKSERVER-MEMBER": "members",
                      },
-                     "dirRecordAttrToDSAttrMap" : {
-                        "guid" :            dsattributes.kDS1AttrGeneratedUID,
-                        "fullName" :        dsattributes.kDS1AttrDistinguishedName,
-                        "firstName" :       dsattributes.kDS1AttrFirstName,
-                        "lastName" :        dsattributes.kDS1AttrLastName,
-                        "emailAddresses" :  dsattributes.kDSNAttrEMailAddress,
-                        "members" :         dsattributes.kDSNAttrGroupMembers,
+                     "dirRecordAttrToDSAttrMap": {
+                        "guid": dsattributes.kDS1AttrGeneratedUID,
+                        "fullName": dsattributes.kDS1AttrDistinguishedName,
+                        "firstName": dsattributes.kDS1AttrFirstName,
+                        "lastName": dsattributes.kDS1AttrLastName,
+                        "emailAddresses": dsattributes.kDSNAttrEMailAddress,
+                        "members": dsattributes.kDSNAttrGroupMembers,
                      },
                 },
             },
-            "maxQueryResults":0,  # max records returned
-            "sortResults":True,  # sort results by UID
-            "implementNot":True,  # implement Not query by listing all records and subtracting
+            "maxQueryResults": 0,  # max records returned
+            "sortResults": True,  # sort results by UID
+            "implementNot": True,  # implement Not query by listing all records and subtracting
        }
 
         #params = self.getParams(params, defaults, ignored)
-        def addDefaults(params, defaults, remove=None):
+        def addDefaults(params, defaults, remove=None): #@UnusedVariable
             for key in defaults:
                 if not key in params:
                     params[key] = defaults[key]
@@ -126,7 +127,6 @@
         implementNot = params["implementNot"]
         del params["implementNot"]
 
-
         assert directoryBackedAddressBook is not None
         self.directoryBackedAddressBook = directoryBackedAddressBook
 
@@ -135,7 +135,6 @@
         self.implementNot = implementNot
         self.rdnSchema = rdnSchema
 
-
         super(XMLDirectoryBackingService, self).__init__(params)
 
 
@@ -158,16 +157,16 @@
             vcardPropToDirRecordAttrMap = queryMap["vcardPropToDirRecordAttrMap"]
             dirRecordAttrToDSAttrMap = queryMap["dirRecordAttrToDSAttrMap"]
 
-            kind = {self.recordType_groups:"group",
-                    self.recordType_locations:"location",
-                    self.recordType_resources:"calendarresource",
+            kind = {self.recordType_groups: "group",
+                    self.recordType_locations: "location",
+                    self.recordType_resources: "calendarresource",
                     }.get(recordType, "individual")
 
             constantProperties = ABDirectoryQueryResult.constantProperties.copy()
             constantProperties["KIND"] = kind
             # add KIND as constant so that query can be skipped if addressBookFilter needs a different kind
 
-            filterPropertyNames, dsFilter = dsFilterFromAddressBookFilter(addressBookFilter, vcardPropToDirRecordAttrMap, constantProperties=constantProperties);
+            filterPropertyNames, dsFilter = dsFilterFromAddressBookFilter(addressBookFilter, vcardPropToDirRecordAttrMap, constantProperties=constantProperties)
             self.log.debug("doAddressBookQuery: rdn=%s, query=%s, propertyNames=%s" % (recordType, dsFilter if isinstance(dsFilter, bool) else dsFilter.generate(), filterPropertyNames))
 
             if dsFilter:
@@ -195,9 +194,9 @@
                         for match in matches:
                             #self.log.debug("recordsForDSFilter: match=%s" % (match.generate(), ))
                             xmlMatchType = {
-                                dsattributes.eDSExact :        "exact",
-                                dsattributes.eDSStartsWith :   "starts-with",
-                                dsattributes.eDSContains :     "contains",
+                                dsattributes.eDSExact: "exact",
+                                dsattributes.eDSStartsWith: "starts-with",
+                                dsattributes.eDSContains: "contains",
                             }.get(match.matchType)
                             if not xmlMatchType:
                                 self.log.debug("recordsForDSFilter: match type=%s match not supported" % (match.generate(),))
@@ -220,7 +219,6 @@
                                     self.log.debug("recordsForDSFilter: NOT expression not supported" % (match.generate(),))
                                     returnValue(None)
 
-
                         # evaluate subexpressions
                         subexpressions = [subexpression for subexpression in dsFilterSubexpressions if isinstance(subexpression, dsquery.expression)]
                         for subexpression in subexpressions:
@@ -300,8 +298,7 @@
 
         #sort results so that CalDAVTester can have consistent results when it uses limits
         if self.sortResults:
-            results = sorted(list(results), key=lambda result:result.vCard().propertyValue("UID"))
+            results = sorted(list(results), key=lambda result: result.vCard().propertyValue("UID"))
 
         self.log.info("limited  %s len(results) %s" % (limited, len(results),))
         returnValue((results, limited,))
-

Modified: CalendarServer/branches/users/gaya/xmldirectorybacker/twistedcaldav/stdconfig.py
===================================================================
--- CalendarServer/branches/users/gaya/xmldirectorybacker/twistedcaldav/stdconfig.py	2013-10-10 18:51:46 UTC (rev 11803)
+++ CalendarServer/branches/users/gaya/xmldirectorybacker/twistedcaldav/stdconfig.py	2013-10-10 19:02:50 UTC (rev 11804)
@@ -227,13 +227,11 @@
         "dsLocalCacheTimeout": 30,
         "fakeETag": True,
         "addDSAttrXProperties": False,
-        "appleInternalServer": False,
         "additionalAttributes" : [],
         "allowedAttributes" : [],
         "searchAttributes" : [],
     },
     "twistedcaldav.directory.ldapdirectorybacker.LdapDirectoryBackingService": {
-        "appleInternalServer": False,
         "warningThresholdSeconds": 3,
         "uri": "ldap://localhost/",
         "tls": False,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20131010/7a4efcdc/attachment-0001.html>


More information about the calendarserver-changes mailing list